Chartjs-How to set a length difference in chart?

0👍

See the Chart.js documentation on linear scales.

Set the ticks.stepSize for your yAxis to 100. You may also want to set ticks.beginAtZero to true.

Here’s a full example:

{
  type: 'bar',
  data: {
    labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
    datasets: [
      {
        label: 'Data',
        data: [602, 102, 510, 240, 680, 740, 410],
        fill: false,
      }
    ],
  },
  options: {
    scales: {
      yAxes: [
        {
          ticks: {
            stepSize: 100,
            beginAtZero: true,
          },
        },
      ],
    },
  },
}

Chart with custom step size

Leave a comment