Chartjs-How to fix the number of gridlines in X-Axis as label are too condensed

0👍

Assuming you defined xAxes.time.unit: 'month', you can define time.stepSize as follows.

xAxes: [{
  type: 'time',
  time: {
    unit: 'month',
    stepSize: 2
  },

time.stepSize: the number of units between grid lines.

Chart.js internally uses Moment.js for the functionality of the time axis. Therefore you should use the bundled version of Chart.js that includes Moment.js in a single file.

Leave a comment