【发布时间】:2016-09-19 09:56:13
【问题描述】:
我正在使用 Crossfilter(DC.JS 和 D3)来可视化大量数据。我喜欢图书馆的交互性,但我的数据很快就变得太大了。我认为处理这个问题的最佳方法是在数据太大时预先聚合我的数据。我很难找出 Crossfilter 如何(以及是否)可以处理此类数据。
为了说明,我拥有的数据是形式
[
{"date":"01-01-2016","food": "apple", "gender": "M", "country": "DE"},
{"date":"01-01-2016","food": "pear", "gender": "M", "country": "DE"},
{"date":"01-01-2016","food": "apple", "gender": "F", "country": "DE"},
{"date":"01-01-2016","food": "apple", "gender": "F", "country": "UK"},
{"date":"01-02-2016","food": "pear", "gender": "M", "country": "UK"},
{"date":"01-02-2016","food": "pear", "gender": "M", "country": "UK"},
{"date":"01-02-2016","food": "apple", "gender": "M", "country": "US"},
...
]
我将如何通过可视化围绕日期字段进行旋转?那么知道在 01-01,我有 3 个人购买苹果,例如 2 个来自德国(1 个男性,1 个女性)和 1 个来自英国,例如?
我想我可以通过为每个组合计算一种数据立方体然后计算它来做到这一点,如下所示:
[
{"date":"01-01-2016","food": "apple", "gender": "M", "country": "DE", "count": 100000},
{"date":"01-01-2016","food": "pear", "gender": "M", "country": "DE", "count": 72651},
{"date":"01-01-2016","food": "apple", "gender": "F", "country": "DE", "count": 12345},
{"date":"01-01-2016","food": "apple", "gender": "F", "country": "UK", "count": 9287164},
{"date":"01-02-2016","food": "pear", "gender": "M", "country": "UK", "count": 291732743},
{"date":"01-02-2016","food": "apple", "gender": "M", "country": "US", "count": 128176376}
...
]
但是通过这种设置,我并没有在数据量上赢得太多,而且我不完全确定 Crossfilter 如何/是否可以以这种方式处理表示的数据。
【问题讨论】:
标签: javascript visualization dc.js crossfilter