0👍
By default, Chart.js automatically calculates how many labels can be shown and hides labels accordingly. This is controlled by ticks.autoSkip
that has default value true
.
If you explicitly define yAxes.ticks.stepSize
however, autoSkip
is ignored and a tick is shown for all matching steps.
Solution 1
The easiest solution is to remove yAxis.ticks
from the options and let autoSkip
manage tick generation.
Solution 2
You may also increase stepSize
and choose whatever suits you.
yAxes: [{
ticks: {
stepSize: 10
}
}]
Solution 3
Another option would be to define the exact number of ticks to be show using yAxes.ticks.maxTicksLimit
.
yAxes: [{
ticks: {
maxTicksLimit: 5
}
}]
- Chartjs-Displaying the first value of the array in datasets.label Chartjs
- Chartjs-ChartJS Bar chart with time scale – Bars overlap with each other
Source:stackexchange.com