使用DC js和Crossfilter以及数据表的多个饼图

时间:2019-04-08 14:21:50

标签: dc.js crossfilter

我想创建类似这样的东西 enter image description here

我使用简单的D3实现了这一目标,但我想使其具有交互性,并使用dc.js(饼图,DataTables)和交叉过滤器通过选择过滤数据。

我不明白如何从以下数组向dc.js饼图提供多个组和维度:

var data = [
        {Batch: 4563, Contact: "MFG-MQA", lateSteps: 668, completedSteps: 2263, openSteps: 4144},
        {Batch: 6234, Contact: "MFG-Production", lateSteps: 204, completedSteps: 618, openSteps: 1162},
        {Batch: 1245, Contact: "MFG-QC", lateSteps: 293, completedSteps: 1046, openSteps: 1917},
        {Batch: 4123, Contact: "MFG-WTE", lateSteps: 619, completedSteps: 1874, openSteps: 3425},
        {Batch: 5123, Contact: "PKG-MQA", lateSteps: 536, completedSteps: 1847, openSteps: 3397},
        {Batch: 6123, Contact: "PKG-Production", lateSteps: 281, completedSteps: 866, openSteps: 1543},
        {Batch: 7123, Contact: "PKG-QA Floor", lateSteps: 113, completedSteps: 52, openSteps: 580},
        {Batch: 8123, Contact: "PKG-QP", lateSteps: 74, completedSteps: 234, openSteps: 399},
        {Batch: 9123, Contact: "MFG-QC", lateSteps: 293, completedSteps: 1046, openSteps: 1917},
        {Batch: 723, Contact: "MFG-WTE", lateSteps: 619, completedSteps: 1874, openSteps: 3425},
        {Batch: 2343, Contact: "PKG-MQA", lateSteps: 536, completedSteps: 1847, openSteps: 3397},
        ];

因此,根据传说,

  

totalSteps = openSteps + completedSteps;

     

completedSteps =相同联系人的所有completedSteps之和

     

lateSteps =相同联系人的所有晚期步骤的总和

使用此方法可以根据提到的“联系人”创建多个饼图,并对各个值进行求和。

0 个答案:

没有答案