我有以下csv文件来绘制两组不同的数据:正常和全局及其各自的回归。
Access grade global,Grade_global,Regression_global,Access grade,Grade,Regression
11.48,6.0,5.66,11.48,6.0,5.74
11.43,5.6,5.63,11.43,5.6,5.69
12.13,5.9,6.16,12.13,5.9,6.55
10.48,5.0,4.91,10.48,5.0,4.52
10.54,4.7,4.96,10.54,4.7,4.6
10.23,5.1,4.73,10.23,5.1,4.22
12.27,5.5,6.26,12.27,5.5,6.71
11.13,4.2,5.4,11.13,4.2,5.32
13.7,10.0,7.34,13.7,10.0,8.46
我想创建一个包含所有点的散点图,每个组都有不同的颜色,并且各自有线性回归(已经计算过的回归点)。我正在尝试分配"访问等级全球"和"访问等级"作为" Grade" /" Grade_global"的x值和"回归" /"回归_全球"
我该怎么办?我的实际代码是:
var chart = c3.generate({
bindto: '#chart0',
data: {
url: '../static/CSV/Chart_data/grades_access_hs.csv?rnd='+(new Date).getTime(),
xs: {
Grade_global: 'Access grade global',
Grade: 'Access grade'
},
type: 'scatter',
types: {
Regression_global: "line",
Regression: 'line'
},
},
axis: {
y: {
label: {
text: "Average grade",
position: "outer-middle"
},
min: 1,
max: 9
},
x: {
label: {
text: "Access grade PAU",
position: "outer-center"
},
min: 9,
max: 14
}
},
size: {
height: 400,
width: 800
},
zoom: {
enabled: true
},
legend: {
show: true,
position: 'inset',
inset: {
anchor: 'top-right',
x: 20,
y: 300,
step: 1
}
},
})
我收到错误:未捕获错误:x未定义为id =" Regression_global"。
谢谢!