我使用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。謝謝。 –