问题
Highcharts has this neat feature when hovering over a bar in a column chart, the entire series is highlighted, best seen live here:
In the R wrapper highcharter
this does not work, why?
library(highcharter)
library(tidyverse)
hc <- highchart() %>%
hc_chart(type = "column") %>%
hc_xAxis(categories = c('Apples', 'Oranges', 'Pears', 'Grapes', 'Bananas')) %>%
hc_add_series(name = "John", data = c(5, 3, 4, 7, 2)) %>%
hc_add_series(name = "Jane", data = c(2, -2, -3, 2, 1)) %>%
hc_add_series(name = "Joe", data = c(3, 4, 4, -2, 5))
hc
回答1:
Because current highcharter uses Highcharts 7.0.1, but this series highlighting (officially called inactive state) exists since Highcharts 7.1.0 version. See the changelog here: https://www.highcharts.com/blog/changelog/#highcharts-v7.1.0
回答2:
You can use the development version from Github and this feature will work for you. The CRAN version is still referring the older version of Highcharts.
devtools::install_github("jbkunst/highcharter")
https://github.com/jbkunst/highcharter
来源:https://stackoverflow.com/questions/56185382/how-to-get-series-highlight-on-hover-in-highcharter