-->

Using dimensions with arrays in dc.js/crossfilter

2019-03-29 21:23发布

问题:

Crossfilter supports dimensions with arrays since version 1.4.0-alpha.06 https://github.com/crossfilter/crossfilter/wiki/API-Reference#dimension_with_arrays

Is it possible to exploit this functionality in dc.js?

I haven' found any examples yet... I am aware of the method described in Is there a way to tell crossfilter to treat elements of array as separate records instead of treating whole array as single key?, but that works with earlier versions of crossfilter too (it does not make use of the new functionality).

回答1:

With help from comments above, I managed to get this working, very simple indeed if you use the right version of crossfilter (1.4.0). Works fine with rowChart() and pieChart().

I made a an example bl.ock based on previous approaches: http://bl.ocks.org/emiguevara/4bd152a8828f6b31270702d97dc0133d