0👍
✅
This ca be achieved by defining the y-axis as follows:
y: {
suggestedMin: 0,
suggestedMax: 15,
ticks: {
stepSize: 5
}
}
Please take a look at below runnable code and see how it works.
new Chart('myChart', {
type: 'bar',
data: {
labels: ['A', 'B', 'C'],
datasets: [{
label: 'My Dataset',
data: [,,]
}]
},
options: {
scales: {
y: {
suggestedMin: 0,
suggestedMax: 15,
ticks: {
stepSize: 5
}
}
}
}
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/3.9.1/chart.js"></script>
<canvas id="myChart" height="90"></canvas>