作者:mobiledu2502891177 | 来源:互联网 | 2023-01-15 10:42
1> sf8193..:
对于那些有类似问题的人。我需要使数据com_passed和com_failed作为数组而不是像这样的整数。
var com_passed = rows[rows.length-2]["# Common Passed"];
var com_failed = rows[rows.length-2]["# Common Failed"];
var ctx = document.getElementById("common_chart");
ctx.height = 50;
var historicalChart = new Chart(ctx, {
type: 'bar',
data: {
labels: ["Passed", "Failed"],
datasets: [
{
data: [com_passed],
label: "Passed",
fillColor: "red"
},
{
data: [com_failed],
label: "Failed",
fillColor: "green"
}
]
},
options: {
scales: {
yAxes: [{
ticks: {
beginAtZero:true,
responsive: false,
maintainAspectRatio: true
}
}]
}
}
});