Description Usage Arguments Details Value Note Examples
This function will add a CSS rule to a widget-created
DOM stylesheet. rule
should be a valid CSS rule as you
would enter in a <style>...</style>
block. No checking is done
to ensure validity.
1 | tau_add_css_rule(tau, rule, warn = TRUE)
|
tau |
taucharts object |
rule |
character vector of CSS rule(s) to add to the widget DOM |
warn |
show warnings for global CSS rules? (default: |
Use {{ID}}
(followed by a space) to target the CSS rule
just to the widget vs the whole DOM.
Vectorized over rule
taucharts htmlwidget object
This is for expert use only. You need to know quite a bit about the visualization
and target DOM to effectively use this function. CSS rules without the {{ID}}
are applied to the entire DOM.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | # change the default white tooltip to black
if (interactive()) {
make_black_tooltip <- function(tau) {
tau %>%
tau_add_css_rule(
".tau-chart__tooltip__gray-text { color: white; font-weight: bold; }") %>%
tau_add_css_rule(
".tau-chart__tooltip__list__elem:first-child {color:white;font-weight:bold;}") %>%
tau_add_css_rule(
".tau-chart__tooltip__exclude { color: white; }") %>%
tau_add_css_rule(
paste0(c(".tau-chart__tooltip__exclude:hover { color: #65717f; ",
"background: linear-gradient(to right, rgba(255, 255, 255, 0) 100%, ",
"rgba(235, 238, 241, 0.9) 0%); }"), collapse="\n")) %>%
tau_add_css_rule(".tau-chart__tooltip { background: black; color: white; }")
}
tauchart(mtcars) %>%
tau_point("wt", "mpg", color="cyl") %>%
tau_color_manual(c("blue", "maroon", "black")) %>%
tau_tooltip() %>%
make_black_tooltip()
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.