我使用Crossfilter(DC.JS,因此D3)可视化大量数据。我喜欢图书馆的互动性,但我的数据很快变得太大。我认为适合处理这个问题的最好方法是预先汇总我的数据,如果它太大。我很难发现如何(以及如果)Crossfilter可以使用这类数据。关于汇总结果的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如何处理数据。
感谢您的解释。其实我的问题是一个通用的问题,你的通用答案帮助我解决问题。看来,我一直在以错误的方式使用reduceSum。谢谢。 –