https://github.com/timelyportfolio/tooltipsterR
R htmlwidget for tooltipster
https://github.com/timelyportfolio/tooltipsterR
Last synced: 5 months ago
JSON representation
R htmlwidget for tooltipster
- Host: GitHub
- URL: https://github.com/timelyportfolio/tooltipsterR
- Owner: timelyportfolio
- License: other
- Created: 2015-10-26T15:08:19.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-11-05T19:35:06.000Z (over 9 years ago)
- Last Synced: 2024-10-30T10:40:40.607Z (6 months ago)
- Language: CSS
- Size: 195 KB
- Stars: 13
- Watchers: 4
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.Rmd
- License: LICENSE
Awesome Lists containing this project
- jimsghstars - timelyportfolio/tooltipsterR - R htmlwidget for tooltipster (CSS)
README
```{r, setup, echo = FALSE, message = FALSE}
knitr::opts_chunk$set(
comment = "#>",
tidy = FALSE,
error = FALSE,
fig.width = 8,
fig.height = 8)
```# tooltipsterR
> Interactive Tooltip htmlwidget
[](https://travis-ci.org//tooltipsterR)
[](http://www.r-pkg.org/pkg/tooltipsterR)
[](http://www.r-pkg.org/pkg/tooltipsterR)`tooltipsterR` is an htmlwidget wrapper for the excellent jQuery [tooltipster](iamceege.github.io/tooltipster/) library for interactive tooltips.
## Installation
```{r eval = FALSE}
devtools::install_github("timelyportfolio/tooltipsterR")
```## Usage
### Basic with `htmltools`
```{r eval = FALSE}
library(tooltipsterR)
library(htmltools)browsable(
tagList(
tags$p(
"See my ",
tags$span(
class="tooltip",
style="color:gray;",
title="tooltips provided by tooltipsterR",
"tooltip"
)
),
tooltipster()
)
)
```### Medium with `formattable`
```{r eval = FALSE}
library(tooltipsterR)
library(formattable)
library(htmltools)#example from ?formatter
top10red <- formatter(
"span",
class = x ~ ifelse(rank(-x) <= 10, "tooltipster-tooltip", ""),
style = x ~ ifelse(rank(-x) <= 10, "color:red", NA),
title = x ~ ifelse(rank(-x) <= 10, "top 10", "not top 10")
)
yesno <- function(x) ifelse(x, "yes", "no")browsable(
tagList(
formattable::as.htmlwidget(formattable(mtcars, list(mpg = top10red, qsec = top10red, am = yesno))),
tooltipster(".tooltipster-tooltip")
)
)
```### Medium with `remoji`
```{r eval = FALSE}
library(tooltipsterR)
library(remoji)
library(stringi)
library(htmltools)browsable(
tagList(
twemoji(),
lapply(
find_emoji(""),
function(heart){
tags$div(
style="float:left;",
class="tooltip",
title = heart,
HTML(stri_trans_general(emoji(heart),"any-hex/xml"))
)
}
),
tooltipster()
)
)
```### Advanced with `svglite`
```{r eval = FALSE}
library(tooltipsterR)
library(htmltools)
library(svglite)browsable(
tagList(
htmlSVG(plot(1:3,col=blues9[7:9],pch=16)),
tooltipster(),
tags$script(
"
$('circle').each(function(){
$(this).tooltipster({
content: $(this).css('fill')
})
})
"
)
)
)
```## License
MIT + file LICENSE © [Kenton Russell](https://github.com/).