Dc.js: Bar Chart On Subset Of Data
I have data in format [ { 'date': dt1, 'action': 'T', 'isRequest': '', 'delay': 0 }, { 'date': dt1, 'action': 'C1', 'isRequest': 'R', 'delay': 10 }, { 'date': dt1, 'action': 'T',
Solution 1:
You would want to implement a filter in a custom group so that the group only aggregates records that meet your criteria. You can use a helper library like Reductio to do this and would build your group something like:
var dim = ndx.dimension(...);
vargroup = reductio().count(true)
.filter(function(d) { return d.action === "C1"; })(dim.group());
Example in the documentation here: https://github.com/crossfilter/reductio#aggregations-standard-aggregations-reductio-b-filter-b-i-filterfn-i-
It is also possible to do this directly using custom groups, but it's a bit complex.
Unrelated: group.reduceCount doesn't take a parameter, so the functions you are passing to it in your example aren't doing anything.
Post a Comment for "Dc.js: Bar Chart On Subset Of Data"