Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Chart.js chartjs数据集从单行到多行_Chart.js - Fatal编程技术网

Chart.js chartjs数据集从单行到多行

Chart.js chartjs数据集从单行到多行,chart.js,Chart.js,请帮忙,谢谢。 我现在正在编写chartjs的数据部分 var configcount = {type: "line",data: { labels: ["Apr20", "May20", "Jun20", "Jul20", "Aug20", "Sep20", "Oct20"], datasets: [{label: "Bala

请帮忙,谢谢。 我现在正在编写chartjs的数据部分

var configcount = {type: "line",data: {
labels: ["Apr20", "May20", "Jun20", "Jul20", "Aug20", "Sep20", "Oct20"],
datasets: [{label: "Balance1",
    data: [10, 20, 30, 40, 50, 60, 70],
    fill: false,pointBorderWidth: ...
,},},],},},};

要更改多行平衡1:10、20、30、40、50、60、70和平衡2:15、30、15、30、15、30、15,您需要定义两个不同的数据集,如下所示

data: {
  labels: ["Apr20", "May20", "Jun20", "Jul20", "Aug20", "Sep20", "Oct20"],
  datasets: [{
    label: "Balance1",
    data: [10, 20, 30, 40, 50, 60, 70],
    ...
  }, {
    label: "Balance2",
    data: [15, 30, 15, 30, 15, 30, 15],
    fill: false,
    ...
  }]
}
请看下面的代码,看看它是如何工作的

新图表(document.getElementById(“图表”){
键入:“行”,
数据:{
标签:[“四月二十日”、“五月二十日”、“六月二十日”、“七月二十日”、“八月二十日”、“九月二十日”、“十月二十日”],
数据集:[{
标签:“余额1”,
数据:[10,20,30,40,50,60,70],
填充:假,
背景色:“rgba(255,99,132,0.2)”,
边框颜色:“rgb(255、99、132)”,
点边界宽度:10
}, {
标签:“余额2”,
数据:[15,30,15,30,15,30,15],
填充:假,
背景色:“rgba(54162235,0.2)”,
边框颜色:“rgb(54162235)”,
点边界宽度:4,
}]
},
选项:{
比例:{
雅克斯:[{
滴答声:{
贝吉纳泽罗:是的
}
}]
}
}
});

您需要定义两个不同的数据集,如下所示

data: {
  labels: ["Apr20", "May20", "Jun20", "Jul20", "Aug20", "Sep20", "Oct20"],
  datasets: [{
    label: "Balance1",
    data: [10, 20, 30, 40, 50, 60, 70],
    ...
  }, {
    label: "Balance2",
    data: [15, 30, 15, 30, 15, 30, 15],
    fill: false,
    ...
  }]
}
请看下面的代码,看看它是如何工作的

新图表(document.getElementById(“图表”){
键入:“行”,
数据:{
标签:[“四月二十日”、“五月二十日”、“六月二十日”、“七月二十日”、“八月二十日”、“九月二十日”、“十月二十日”],
数据集:[{
标签:“余额1”,
数据:[10,20,30,40,50,60,70],
填充:假,
背景色:“rgba(255,99,132,0.2)”,
边框颜色:“rgb(255、99、132)”,
点边界宽度:10
}, {
标签:“余额2”,
数据:[15,30,15,30,15,30,15],
填充:假,
背景色:“rgba(54162235,0.2)”,
边框颜色:“rgb(54162235)”,
点边界宽度:4,
}]
},
选项:{
比例:{
雅克斯:[{
滴答声:{
贝吉纳泽罗:是的
}
}]
}
}
});


对不起,所有的“,}”是怎么回事?对不起,所有的“,}”是怎么回事?