ng2-charts: How to set fixed range for y axis

user2347528 picture user2347528 · Aug 21, 2018 · Viewed 8.4k times · Source

I have a chart.js chart using ng2-charts module. The chart shows Percentage on y axis and time on x axis. Is it possible to set y axis to show 0 to 100 instead of dynamic range based on data?

Answer

Cookie picture Cookie · Oct 9, 2018

Try adding the following to your chart options:

scales : {
  yAxes: [{
     ticks: {
        steps : 10,
        stepValue : 10,
        max : 100,
        min: 0
      }
  }]
}

https://github.com/valor-software/ng2-charts/issues/853