Chartjs-Chart.js with wrong Y axis

3👍

This is because, ChartJS automatically calculates y-axis ticks, which sometimes make the y-axis look incorrect, specially when the maximum tick­‘s value is less than or equal to 5.

One easiest way to solve this, is to set the stepSize property to 1 for y-axis ticks, as such :

scales: {
   yAxes: [{
      ticks: {
         stepSize: 1
      }
   }]
}

Leave a comment