0
If you update to the latest Chart.js version (currently v2.6.0), you can use the max
tick configuration option to set the max number to display on the axis:
options: {
scales: {
yAxes: [{
ticks: {
max: yourMaxNum
}
}]
}
}
If you want to set yourMaxNum
to the largest number in all your dataset arrays, simply use the JavaScript Math.max()
method to determine this number, and set the above chart config option to this number when you create all your line charts.
The Chart.js documentation lists additional tick configuration options that you might also find useful.
- Chartjs-How can I make bar charts symmetrical in chart.js?
- Chartjs-ChartJS passing data dynamically, then passing data into variables
Source:stackexchange.com