Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

You can decrease the vertical spacing on the Y axis of a chart created with Chart.js by tweaking the ticks configuration in the options object. Here's an example:

var options = {
  scales: {
    yAxes: [{
      ticks: {
        stepSize: 1, // set the interval to 1
        min: 0 // set the minimum value to 0
      }
    }]
  }
};

In this example, we set stepSize to 1 to specify that the Y axis ticks should be spaced apart by 1 unit (for example, 0, 1, 2, 3, etc.). We also set min to 0 to ensure that the minimum value on the Y axis starts at 0. You can adjust these values according to your data and visualization requirements.