i have a problem, I want to count the different elements of bar and num associated with foo
var data = crossfilter([
{ foo: 'one', bar: 'A', num: '1' },
{ foo: 'two', bar: 'B', num: '2' },
{ foo: 'three', bar: 'A', num: '3' },
{ foo: 'one', bar: 'B', num: '3' },
{ foo: 'one', bar: 'A', num: '2' },
{ foo: 'two', bar: 'B', num: '2' },
]);
ie, I want to get, for example:
[ { key: 'one', value: { exceptionCount: 2, exceptionCount2: 3 }, // 'bar' dimension has 2 values: 'A' and 'B', and has 3 values: '1' and '2' and '3'
{ key: 'two', value: { exceptionCount: 1, exceptionCount2: 1 }, // 'bar' dimension has 1 value: 'B', '2'
{ key: 'three', value: { exceptionCount: 1 , exceptionCount2: 1} ] // 'bar' dimension has 1 value: 'A', '3'
I have use of the reductio library with exceptionCount to separate for num and bar, but I could not join both associated with only foo.
Can you help me, please
Yes, the reductio.value
method lets you put multiple reducers of the same type on a group. There is an example in the README using exceptionSum
that can be adapted to use exceptionCount
. Your group structure will change a bit.