在DC.js中创建带有多个复选框的分组条形图

时间:2018-03-21 08:00:17

标签: dc.js crossfilter

如何制作带有复选框的分组条形图以隐藏/显示单个系列?

选中此复选框后,应为条形图的每个组添加一个系列。 我想使用 dc.js

输出应与此快照类似。 Expected grouped bar chart

我的样本数据集

data = [{"under 5 years":12, "5 to 13 years":87, "14 to 17 years":25,"18 to 24 years":15,"25 to 44 years":25,"45 to 64 years":14,"place":"CA"},
{"under 5 years":12, "5 to 13 years":87, "14 to 17 years":25,"18 to 24 years":15,"25 to 44 years":25,"45 to 64 years":14,"place":"TX"},

{"under 5 years":12, "5 to 13 years":87, "14 to 17 years":25,"18 to 24 years":15,"25 to 44 years":25,"45 to 64 years":14,"place":"NY"},

{"under 5 years":12, "5 to 13 years":87, "14 to 17 years":25,"18 to 24 years":15,"25 to 44 years":25,"45 to 64 years":14,"place":"TX"},

{"under 5 years":12, "5 to 13 years":87, "14 to 17 years":25,"18 to 24 years":15,"25 to 44 years":25,"45 to 64 years":14,"place":"FL"},

{"under 5 years":12, "5 to 13 years":87, "14 to 17 years":25,"18 to 24 years":15,"25 to 44 years":25,"45 to 64 years":14,"place":"IL"},

{"under 5 years":12, "5 to 13 years":87, "14 to 17 years":25,"18 to 24 years":15,"25 to 44 years":25,"45 to 64 years":14,"place":"NY"}]

0 个答案:

没有答案