我在highcharter中有一个折线图,我想在工具提示中添加其他信息。数据和代码如下:
library("dplyr")
library("highcharter")
data<- data.frame(Company = c("A", "A", "A", "B", "B", "B"),
Year = c(1,2,3,1,2,3),
Value1 = c(100, 150, 170, 160, 150, 180),
Value2 = c(3, 1, 7, 6, 5, 4))
data<- data %>%
group_by(name = Company) %>%
do(data = .$Value1, Value2 = .$Value2)
series<- list_parse(data)
highchart()%>%
hc_chart(type="line")%>%
hc_add_series_list(series)%>%
hc_tooltip(formatter= JS("function () { return 'Company: ' +
this.series.name + ' <br /> Value1: ' + this.point.y +
'<br /> Value2: ??' ;}"))
如何添加Value2以在工具提示中显示?