This feels like it should be easy :/
The crossfilter API says I can run a reduce on groupAll: https://github.com/square/crossfilter/wiki/API-Reference#groupAll_reduce
But I cannot get it to work. I've tried facts.groupAll() where var facts = crossfilter(data); And I've tried all.reduce() where var all = facts.groupAll(). I've tried with and without brackets and googled for examples. Does anyone know of a working example? I want a single output across all my rows.
I realise my reduce function isn't complete and looks complicated. It works fine reducing a dimension, but gives undefined for groupAll on facts.
Thanks
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');