score:11

for chart.js version < 3.0:

from sanjay dutt's answer:

options:{
  scales: {
    yaxes : [{
      ticks : {
        max : 1,    
        min : -1
      }
    }]
  }
}

for chart.js version >= 3.0:

due to breaking changes in version 3.x, the above mentioned answer doesn't work anymore. chart.js created a migration guide to solve the upcoming problems. the minimum and maximum values can now be configured directly to the options.scales:

options : {
    scales : {
        y : {
            min: -1,
            max: 1,
        }
    }
}

score:33

to fix min and max value for yaxes scale use the below code.

options:{
            scales: {
                yaxes : [{
                    ticks : {
                        max : 1,    
                        min : -1
                    }
                }]
            }
        }

suggestedmax will only works when incoming data is lower than suggestedmax value. suggestedmin will works only when incoming data is greater than suggestedmin value.


Related Query

More Query from same tag