I am using highcharter
and I have the follwoing problem. In https://jkunst.com/highcharter/articles/stock.html at the end you have stacked charts and the tooltips for every series are shown simultaneously:
Assume I have the a highchart created by
require(highcharter)
pd1 <- data.frame(x=1:10,y=rnorm(10))
plt <- highchart() %>%
hc_add_series(pd1, "scatter", hcaes(x = x, y = y), color = "#7cb4ed",
tooltip = list(headerFormat="<b> data1 <b> <br/>",
pointFormat = "x1: {point.x} <br/> y1: {point.y}"),
name = "data1")
pd2 <- data.frame(x=1:10,y=rnorm(10))
plt <- plt %>%
hc_add_series(pd2, "line", hcaes(x = x, y = y), color = "red",
tooltip = list(headerFormat="<b> data2 <b> <br/>",
pointFormat = "x2: {point.x} <br/> y2: {point.y}"),
name = "data2")
plt
How can I achieve the same as in the picture, where all tooltips are shown when moving over a point?
I looked at the hc_tooltip
-function and found the shared
, but plt %>% hc_tooltip(shared=TRUE)
does not work.