我希望创建一个像这样的折线图:
但我不知道如何将渐变添加到背景。此时我已经有了正确显示该行的代码。这是我的图表的代码:
const ctx = document.getElementById("myChart");
var speedData = {
labels: [
"Jan",
"Feb",
"Mar",
"Apr",
"May",
"Jun",
"Jul",
"Aug",
"Sep",
"Oct",
"Nov",
"Dec"
],
datasets: [
{
label: "Car Speed",
data: this.car.energyConsumption,
lineTension: 0,
pointBackgroundColor: "#131921",
pointBorderColor: "white",
pointBorderWidth: 3,
pointRadius: 6,
borderColor: "white"
}
]
};
var chartOptions = {
legend: {
display: false
}
};
new Chart(ctx, {
type: "line",
data: speedData,
options: chartOptions
});
}
缥缈止盈
相关分类