问题
I am struggling in adding one level drilldown in my grouped column chart made using highcharter. To explain, I am taking using the "vaccines" dataset available in highcharter library :
My code (similar) that creates the grouped column chart :
library (highcharter)
library(dplyr)
df <- na.omit(vaccines[vaccines$year %in% c("1928", "1929"),])
df <- ddply(df, c("state", "year"), summarise, count = sum(count))
hc <- hchart(df, type = "column", hcaes(x = state, y = count, group = year)) %>%
hc_xAxis(title = list(text = "States")) %>%
hc_yAxis(title = list(text = "Vaccines")) %>%
hc_chart(type = "Vaccines", options3d = list(enabled = TRUE, beta = 0, alpha = 0)) %>%
hc_title(text = "Demo Example") %>%
hc_subtitle(text = "Click on the on Year to see the Vaccine drill down")
hc
It creates this grouped chart perfectly
I now want to add one level drill down to the chart where I can select the "Year" and corresponding drill down data of the vaccine selected is presented. Can you please help with the best/easiest way to do it considering I have the individual drill down data also in data frames.
Regards, Nikhil
来源:https://stackoverflow.com/questions/44110521/drill-down-of-grouped-column-chart-using-r-highcharter-library