Если вы передаете dat
как data
в своей функции hc_add_series
, вы можете получить доступ к другим столбцам в аргументе tooltip
, например type
:
library(highcharter)
dat = data.frame(first = rnorm(10), second = rnorm(10), type = rep(c("AAPL", "MSFT"),5))
highchart()%>%
#hc_xAxis(categories = dat$Open_Date)%>%
hc_add_series(name = "first", data = dat, hcaes(y = first), type = "column",
tooltip = list(pointFormat = "{point.type}: {point.first}"))%>%
hc_add_series(name = "second", data = dat, hcaes(y = second), type = "line",
tooltip = list(pointFormat = "{point.type}: {point.second}"))
![highcharter with custom tooltip](https://i.stack.imgur.com/GlxxJ.png)