我想Y轴从实数更改为整数,这里是形象,请帮我解决这个问题如何在chartjs中将浮点数的Y轴值更改为整数?
这里是我的代码
var lineChartData = {
labels: time,
datasets: [{
label: "Số người đăng kí ủng hộ",
borderColor: window.chartColors.red,
pointBackgroundColor: window.chartColors.red,
fill: false,
data: people_isProcessing
}, {
label: "Số người đã ủng hộ",
borderColor: window.chartColors.purple,
pointBackgroundColor: window.chartColors.purple,
fill: false,
data: people_isReceived
}]
};
,这里是我的选择我的图表
window.onload = function() {
var chartEl = document.getElementById("chart");
window.myLine = new Chart(chartEl, {
type: 'line',
data: lineChartData,
options: {
title: {
display: true,
text: 'Kindmate - Chart Static Donate'
},
tooltips: {
enabled: true,
mode: 'index',
position: 'nearest',
custom: customTooltips
}
}
});
});
请检查这个问题[https://stackoverflow.com/questions/25388901/chart-js-x-axis](https ://stackoverflow.com/questions/25388901/chart-js-x-axis) –