I have a data set defined as such:
var hour = data.crossfilter.dimension(function(d){ return d.date.getHours() + d.date.getMinutes() / 60; });
var hours = hour.group(Math.floor);
The generated result (hours.all()) looks like this:
[0, 124]
[1, 25]
[2, 5]
[3, 2]
[5, 339]
[6, 11648]
[7, 16334]
[8, 15919]
[9, 14078]
[10, 13816]
[11, 14646]
[12, 15079]
[13, 13718]
[14, 13947]
[15, 14055]
[16, 13995]
[17, 16166]
[18, 14958]
[19, 13991]
[20, 12769]
[21, 10638]
[22, 3939]
[23, 892]
Notice that there is a data gap between 3, 5 (4 is missing). How to configure crossfilter to fill in the gaps with 0 instead?
I think you’ll have to fill them in yourself, because I don’t see how Crossfilter could group a value you don’t give to it. That responsibility should fall to whatever object you’re using to present the data.
Are you using d3? I think the linear scale would do that automatically. If not, it would be pretty trivial to do manually.