I’m pretty sure this is not default behaviour as when using a time axis scale with a bar chart, the bars overlap. If you compare this to a standard bar chart the bars would shrink in size. The screen shots are taken from the samples.
As far as I can work out I believe it could be to do with the calculation of the width based on the number of ticks. As the ticks are reduced on the time version to fit the label in the calculation should really still use the number of points. But so far I have not manage to find the exact location in the source.
John
In my case, this fix seems to introduce the same problem it tried to fix (im using v2.1.6 where this fix is already in the code). Let me show the output before removing the fix piece of code from chart js code:

Then after commenting this code:

if (xScale.ticks.length !== me.chart.data.labels.length) { var perc = xScale.ticks.length / me.chart.data.labels.length; fullBarWidth = (fullBarWidth * perc); }
I get the following output, which seems to fix my issue:
Im not sure about the “me.chart.data.labels.length” variable, where and how is its value defined? I think this problem has something to do with the fact im using two datasets, but im not sure, it might be that im doing something wrong.
A colleague and I have been trying to fix the overlapping issue and have come up with the following naive approach that temporarily fixes the issue for our needs. Since we are new to the ChartJS library and are not able to spend the time to re-work the bar chart so that our modifications are properly optimized we would like to share our changes with the community.
In Summary
We have modified the
getRuler
function so that it can find the shortest distance between two points in a data series and uses that distance for the bar width. As mentioned above, this approach is not fully optimized as it will require a little rework so thatgetRuler
is not recalculating the minimum distance every single time it is called. Instead it will need to integrate with responsive and somehow cache this calculation.Whats Fixed
getRuler
)getRuler
)getRuler
)calculateBarX
)First Change made
Second Change Made
Before the code change: https://jsfiddle.net/a1x7p17h/2/
After the code change: https://jsfiddle.net/fmbycrLx/2/