I want to display the differences of two bar charts in the tooltip. I guess that i can access these values via the formatter function. However everything i tried does not work. This is my code:
highchart() %>%
hc_add_series(Marktvolumen$`2017`, type = "column", name = "2017") %>%
hc_add_series(Marktvolumen$`2018`, type = "column", name = "2018") %>%
hc_add_series(Marktvolumen$Aenderung, type = "column", name = "change", visible=FALSE, showInLegend=FALSE) %>%
hc_xAxis(categories = Marktvolumen$Familie) %>%
hc_plotOptions(series = list(showInLegend = TRUE, dataLabels = list(enabled = TRUE, color = "#FFFFFF"))) %>%
hc_tooltip(formatter = JS(paste0('function () {
return this.y[1] - this.y[0];
}')))
The differences are already chart object, but invisible (Marktvolumen$Aenderung
). For me is does not matter if I show the difference via the series object or calculate it via javascript :-)
Here is the barchart:
Thank you!
paste0
)?: stackoverflow.com/questions/42882018/… – Kamil Kulig