如果数据集中有正值和负值,如何将图表上的零与多轴对齐?
我希望零在同一行上。
我不喜欢这个: 图形图像
new Chart(canvas, {
type: 'line',
data: {
labels: ['1', '2', '3', '4', '5'],
datasets: [{
label: 'A',
yAxisID: 'A',
data: [-10, 96, 84, 76, 69]
}, {
label: 'B',
yAxisID: 'B',
data: [-2, 3, 5, 2, 3]
}]
},
options: {
scales: {
yAxes: [{
id: 'A',
type: 'linear',
position: 'left',
}, {
id: 'B',
type: 'linear',
position: 'right',
}]
}
}
});
Run Code Online (Sandbox Code Playgroud)
实际上,官方网页上的示例也有同样的问题。看起来好乱
chart.js ×1