我有一个Chart.js的Barchart,正在尝试显示其数据。这是我的图表代码:
Chart.defaults.global.legend.display = false;
var ctx = document.getElementById('chart2').getContext('2d');
var chart = new Chart(ctx, {
// Configuration options go here
options: {
scales: {
yAxes: [{
ticks: {
beginAtZero: true,
min: 0,
max: 40000,
stepSize: 5000
}
}]
},
responsive: true,
maintainAspectRatio: true,
},
// The type of chart
type: 'bar',
// The data
data: {
labels: ["First", "Second", "Third"],
datasets: [{
backgroundColor: 'rgb(21, 90, 73)',
borderColor: 'rgb(21, 90, 73)',
data: [10810, 30069, 20046],
}],
},
});