Drill Down of grouped column chart using r-highcharter library

感情迁移 提交于 2019-12-23 04:46:02

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!