0

我正在努力在使用 highcharter 制作的分组柱形图中添加一级向下钻取。为了解释,我正在使用 highcharter 库中可用的“疫苗”数据集:

我创建分组柱形图的代码(类似):

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

它完美地创建了这个分组图表 它完美地创建了这个分组图表

我现在想在图表中添加一层向下钻取,我可以在其中选择“年份”,并显示所选疫苗的相应向下钻取数据。考虑到我在数据框中也有单独的向下钻取数据,请您提供最佳/最简单的方法来帮助您。

问候, 尼基尔

4

0 回答 0