Using "fake groups" with reductio

40 views
Skip to first unread message

Karol Mitraszewski

unread,
Oct 18, 2017, 2:54:59 PM10/18/17
to dc-js user group
Hi everyone,

I'm seeking help with the usage of "fake groups".

Part of my data is not available prior to a certain point in time. The corresponding rows in the source dataset  are NULL. 

I count the frequency of occurence on a bar chart, and the NULL values get counted as zeros on that chart, which as far as I understand, is an expected behaviour of crossfilter/dc. 

So I created a fake group to filter them out, succesfully.

My problem is foilowing: apart from the histogram I also want to show the average and standard deviation for that filtered group. I wanted to calculate both using reductio.js, but I'm unable to get it to work. The filtered group has only the .all() method and lacks for example the .value() method which, as far as I understand the probelm I'm facing, is required by reductio.js somewhere under the hoods. 

I'd be very grateful for any hints. It's probably something basic I'm missing here...

Regards,
Karol



Frozenlock

unread,
Oct 31, 2017, 6:35:08 AM10/31/17
to dc-js user group
I'm also interested in this, if anyone has a solution.

Karol Mitraszewski

unread,
Oct 31, 2017, 5:32:31 PM10/31/17
to dc-js user group
I've managed to find a workaround! when defining the reducer in reductio.js one can specify a filter, which eliminates the unwanted values.

    reducer = reductio()
                .sumOfSq(function(d) {return d.ramp1h})
                .sum(function(d) {return d.ramp1h})
                .count(true)
                .avg(true)
                .max(function(d) {return Math.abs(d.ramp1h)})
                .std(true);
    reducer(ramp1hGroup);
  
Hope this helps someone.

Regards,
Karol 

Frozenlock

unread,
Nov 1, 2017, 3:38:04 AM11/1/17
to dc-js user group
Hello Karol,

Thanks for sharing this info.

Did the filters removed your needs to have fake groups?

Karol Mitraszewski

unread,
Nov 1, 2017, 5:27:20 AM11/1/17
to dc-js user group
Hi Frozenlock,

Yes, indeed. In the example above, I set up the reducer on a ramp1hGroup, which is the result of facts.groupAll(), with no further filters or fake groups employed. I only filter out the unwanted values in the .filter() method of the reductio object, as demonstrated above.

Hope that clear enough,
Karol

Frozenlock

unread,
Nov 16, 2017, 6:00:58 PM11/16/17
to dc-js user group
After many iterations, I can't really stay with this solution.
It works relatively well for small samples, but it's very slow for medium dataset and a few charts using the filters. 
:-(
Reply all
Reply to author
Forward
0 new messages