Chartjs-How to keep side bars in Chartjs bar graph from clipping?

1👍

I think it’s the way you are trying to do the axis, its looking to show the values between 00-01, 01-02 etc, in the last data point your axis doesn’t go to 1am, and the first data point is similar, i was able to fix it by changing:

min: moment.unix(new Date(2018, 1, 0, 0, 0, 0).getTime() / 1000),
max: moment.unix(new Date(2018, 1, 0, 0, 60, 0).getTime() / 1000),

to:

min: moment.unix(new Date(2018, 1, 0, 0, -1, 0).getTime() / 1000),
max: moment.unix(new Date(2018, 1, 0, 0, 61, 0).getTime() / 1000),

Might not be exactly what you want but in the fiddle (after adding moment.js as a dependency) it doesn’t cut off your bars.

I haven’t worked with time like this, but maybe the data supplied needs to be different to get it to work.

Leave a comment