Description Usage Arguments Value Note References Examples
Set tooltip of Echarts, at various levels (entire chart, specific series) with
various formats.
When an echart object is generated, you can modify it by setting tooltip using
%>%
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | setTooltip(chart, series = NULL, timeslots = NULL, trigger = NULL,
formatter = NULL, islandFormatter = "{a} < br/>{b} : {c}",
position = NULL, enterable = FALSE, axisPointer = NULL,
textStyle = NULL, showDelay = 20, hideDelay = 100,
transitionDuration = 0.4, bgColor = "rgba(0,0,0,0.7)",
borderColor = "#333", borderWidth = 0, borderRadius = 4, show = TRUE,
...)
setTT(chart, series = NULL, timeslots = NULL, trigger = NULL,
formatter = NULL, islandFormatter = "{a} < br/>{b} : {c}",
position = NULL, enterable = FALSE, axisPointer = NULL,
textStyle = NULL, showDelay = 20, hideDelay = 100,
transitionDuration = 0.4, bgColor = "rgba(0,0,0,0.7)",
borderColor = "#333", borderWidth = 0, borderRadius = 4, show = TRUE,
...)
|
chart |
| ||||||||||||||||||||||||||||||
series |
A vector of series indices or names. e.g., | ||||||||||||||||||||||||||||||
timeslots |
A vector of time slices indices or names, e.g., | ||||||||||||||||||||||||||||||
trigger |
Type of trigger, | ||||||||||||||||||||||||||||||
formatter |
The format of the tooltip content.
Meanings of {a}, {b}, {c}, {d}...
JS Function Param Template...
| ||||||||||||||||||||||||||||||
islandFormatter |
Formatter of data island for calcualable effect. Can be
string (default | ||||||||||||||||||||||||||||||
position |
Can be fixed position array | ||||||||||||||||||||||||||||||
enterable |
If users can click into the tooltip for interacions. Default FALSE. | ||||||||||||||||||||||||||||||
axisPointer |
The pointer formatter of axis. Default is a list | ||||||||||||||||||||||||||||||
textStyle |
text style of the tooltip. In a list form. Default | ||||||||||||||||||||||||||||||
showDelay |
Delayed time at show (ms). Default 20ms. | ||||||||||||||||||||||||||||||
hideDelay |
Delayed time at hide (ms). Default 100ms. | ||||||||||||||||||||||||||||||
transitionDuration |
The time spent at animation exchange. Default 0.4. Set if 0 if you want real-time interaction. | ||||||||||||||||||||||||||||||
bgColor |
Background color of tooltips. Default 'rgba(0,0,0,0.7)' ( semi-transparent dark gray). | ||||||||||||||||||||||||||||||
borderColor |
Borderline color of the tooltips. Default '#333'. | ||||||||||||||||||||||||||||||
borderWidth |
Border width of the tooltips. Default 0 (not shown). | ||||||||||||||||||||||||||||||
borderRadius |
Border radius of the tooltips. Default 4px. | ||||||||||||||||||||||||||||||
show |
Logical. If the tooltips are shown. Default TRUE. | ||||||||||||||||||||||||||||||
... |
Elipsis |
A modified echarts object
Note that the tooltip
feature is inheritable in terms of timeline.
setTooltip
automatically breaks the inheritability by resetting tooltip
formats in the timeslots following the timeslots whose tooltip format are changed.
.
http://echarts.baidu.com/echarts2/doc/option.html#title~tooltip
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | ## Not run:
g = echartR(iris, Sepal.Width, Petal.Width, series=Species)
## global tooltip
g %>% setTooltip(trigger='item', bgColor='rgba(0,0,200,0.7)')
## series-specific tooltip
bg = sapply(c('orange', 'deepskyblue', 'violet'), col2rgb)
bg = rbind(bg, 0.7) # extend the color matrix with alpha 0.7
bgCol = unname(apply(bg, 2, rgba)) # get rgba colors with alpha
g %>% setTooltip(series='setosa', bgColor=bgCol[1]) %>%
setTooltip(series=2, bgColor=bgCol[2]) %>%
setTooltip(series=3, bgColor=bgCol[3])
## series-and-timeline-specific tooltip
bg = sapply(c('orange', 'deepskyblue', 'violet'), col2rgb)
bg = rbind(bg, 0.7) # extend the color matrix with alpha 0.7
bgCol = unname(apply(bg, 2, rgba)) # get rgba colors with alpha
iris$tag = 1 + as.integer(row.names(iris)) %% 3
iris = iris[order(iris$tag),]
g1 = echartR(iris, Sepal.Width, Petal.Width, series=Species, t=tag)
g1 %>% setTooltip(series='setosa', bgColor=bgCol[1]) %>%
setTooltip(series=2, bgColor=bgCol[2]) %>%
setTooltip(series=3, bgColor=bgCol[3]) %>%
setTooltip(t=1, borderColor='red', borderWidth=3) %>%
setTooltip(t=2, borderColor='gold', borderWidth=3) %>%
setTooltip(t=3, borderColor='green', borderWidth=3)
g1 %>% setTooltip(series=2, t=2, bgColor='blue')
# tooltip format of series 2 in the 2nd timeslot is changed to bg blue,
# while it in the 3rd timeslot is reset to default
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.