[Chartjs]-Chart js data to start at zero

11๐Ÿ‘

โœ…

Try Adding min to your options:

    var options = {
      scales: {
        yAxes: [{
          ticks: {
            beginAtZero: true,
            min: 0
          }    
        }]
      }
    };

enter image description here

Live Copepen: Chart.js Start at zero

3๐Ÿ‘

As per chart.js 3.7.1 version

Directly write "beginAtZero" in x or y not in ticks

   const options = {
    scales: {
         x: {
           beginAtZero: true,            
         },
         y: {
           beginAtZero: true,
         }
       }
    };

2๐Ÿ‘

Replaced by:

const options = {
  scales: {
    y: {
      beginAtZero: true
    }
  }
};

It worked!

Leave a comment