This task seems deceptively simple :/
I've been following the crossfilter API instructions on running a reduce operation on groupAll: https://github.com/square/crossfilter/wiki/API-Reference#groupAll_reduce
However, despite my efforts, I can't seem to make it work. I've attempted using facts.groupAll() with var facts = crossfilter(data); and also tried all.reduce() with var all = facts.groupAll(). I've experimented with parentheses both present and absent, and even searched online for examples. Does anyone have a functional example that they could share? My goal is to generate a single output covering all rows.
Upon reflection, I realize that my reduce function is incomplete and appears intricate. While it operates smoothly when reducing a dimension, it returns undefined for groupAll on facts.
Thank you
var accumGrp = facts.groupAll().reduce(
function(p,v) {
for (var i=0; i<supplierFields[0].length; i++) {
if (!p.population[supplierFields[0][i]]) { p.population[supplierFields[0][i]] = []; }
p.population[supplierFields[0][i]].push(v[supplierFields[0][i]+'_l']);
}
return p;
},
function(p,v) { return p; },
function() {
var obj = {};
obj.population = {};
obj.highlight = {};
return obj;
}
);
print_filter('accumGrp');