Skip to content Skip to sidebar Skip to footer

Dc.js LineChart Aggregated By Month/Year

I trying to plot a lineChart and I want to aggregate data by Month. I am using dataset from crossfilter documentation with slight modification in date. This is how my dataset look

Solution 1:

I've had issues with time rendering in dc.js, but in your example the key is to get the month values in your dimension.

var dateDimension = facts.dimension(function (d) {return d3.time.month(d.newDate); });

See the updated fiddle (https://jsfiddle.net/ury1k1bs/1/)

I think the .round() chart method is only useful for brushing, not for rendering.

For more see the time interval example provided by dc.js... http://dc-js.github.io/dc.js/examples/switching-time-intervals.html


Post a Comment for "Dc.js LineChart Aggregated By Month/Year"