在图表options
内,您可以如下定义scales.yAxis.ticks.max
的值:
scales.yAxis.ticks.max
var myBarChart = new Chart(document.getElementById("myChart"), {
type: 'bar',
data: {
labels: ["A", "B", "C", "D", "E", "G", "H"],
datasets: [{
backgroundColor: "lightblue",
data: [3200, 3250, 3300, 3350, 3400, 3450, 3500],
}]
},
options: {
legend: {
display: false
},
tooltips: {
enabled: false
},
scales: {
yAxes: [{
ticks: {
min: 3000,
max: 3600,
stepSize: 200
}
}]
}
}
});