Chartjs-Chart.js 2.9.4 – howto set a margin for axes min\max and time axis label separation

1πŸ‘

βœ…

For your first problem afaik there is no other solution as to calculate it yourself, in V3 they added a grace property (docs) which does this but it only applies to linear axis.

For your second problem you can use the tick callback. You get the value and then you can check your data source if it has a point matched to it, if so you return it again, if not you can return an empty string. See this example for more info: https://www.chartjs.org/docs/master/samples/scale-options/ticks.html

For your third problem you can increase the autoSkipPadding (docs)

Leave a comment