我正在创建一个图表,使用chart js呈现一些数据.
const data = {
labels: ["1 Dec", "8 Dec", "16 Dec", "31 Dec"],
datasets: [
{
label: "Sales Made",
data: [3, 7, 4, 5],
borderColor: ["#03A9F5"],
},
],
};
const options = {
tension: 0.4,
title: {
display: true,
text: "linechrt",
},
scales: {
y: [
{
display: true,
stacked: true,
ticks: {
beginAtZero: true,
steps: 10,
stepValue: 5,
min: 0,
max: 100,
},
},
],
},
};
现在我已经看过了在线教程,甚至是文档,但我还没有得到how to paint the area below the line.个图表的明确答案.JS有很多版本,以前对这个问题的答案,尤其是在Stack上,似乎不起作用.
对于其他图表,如条形码
backGroundColor: ["red"]
在datasets对象上运行良好,但如果我try 对折线图执行相同的操作,则不会
<Line data={data} options={options} />