Accepted answer

I think you are running into this issue: elasticX for linear domain doesn't include the rightmost bar

(Or a similar issue.)

dc.js takes its boundaries very literally, and it also computes them literally, so much that it doesn't take the width of its own bars into consideration.

One simple way to work around this is to add some padding:


Since you are aggregating by month, this will make sure there is always a month to the left and right of the calculated domain (which will be of width 0 when there is only one bar).

Of course, you will end up with that single bar filling the chart: big bar

So you might want to calculate the domain manually, in preRedraw, until dc.js gets better at this.

Fork of your fiddle:

Related Query