javascript - Crossfilter reduceSum goes wildly wrong -


i'm using crossfilter large set of data dimension grouped timestamp (epoch millis). i'm doing reduce sum on 1 of values , seems correct until last value.

i've prepared simple code:

var group = api.getdimension().group(function (d) {     return d.wholepropertypowertimestamp; }); group.reducesum(function(d) {     if (d.wholepropertypowertimestamp === 1489428000000) {          console.log("d.wholepropertypower: " + d.wholepropertypower);     }     return d.wholepropertypower; }).top(1); 

very simply, takes dimension, applies timestamp group values, runs reduce sum on , if timestamp time on march 13th (this diagnostic, last value , 1 sum incorrect), console output show values before summed.

it complex post meaningful representation fiddler (or analog). best can a screenshot of simple test in dev environment. expected result (a manual sum of console logs) should 1530.25, sumreduce gives result of 6184153.75.

this not sum of values, if modify group use 1 group of natural ordering:

var group = api.getdimension().group(); 

the summed value of every element's wholepropertypower 9699141.59375.

how group dimension , implement reducesum function?


Comments