[Chartjs]-Is it possible to set up 0 as a minimum number for bar chart? react-chart.js-2

12πŸ‘

βœ…

To start the y-axis from 0, you would have to set the beginAtZero property to true for y-axis ticks, in your chart options, like so :

options={{
  scales: {
    yAxes: [{
      ticks: {
        beginAtZero: true
      }
    }]
  }
}}

see – working demo

0πŸ‘

You need to add this piece of code to the dataset object

options: {
              scales: {
                  yAxes: [{
                      ticks: {
                          beginAtZero: true,
                      }
                  }]
              }
          }

You can read more in the docs Axes Range setting

Leave a comment