[英]Chart.js Line Chart Stacked: Repeat left Y-Axis on the right
I want to have the same y axis from the left also on the right of the chart with exactly the same scale.我想在图表的右侧也有相同的 y 轴,并且具有完全相同的比例。 I am using a stacked line chart and i create multiple axis .我正在使用堆叠折线图并创建多个轴。 The result i get is, that the right y-axis has a different scale (0 - 1) than the left one (0 - 6000).我得到的结果是,右侧 y 轴的比例(0 - 1)与左侧(0 - 6000)不同。
scales: {
'left-y-axis': {
type: 'linear',
stacked: true,
position: 'left',
},
'right-y-axis': {
type: 'linear',
position: 'right',
},
},
I have create a jsfiddle with my example, where you see that the left and right y-axis differ: https://jsfiddle.net/3yk4wfag/5/我用我的示例创建了一个 jsfiddle,您可以在其中看到左右 y 轴不同: https://jsfiddle.net/3yk4wfag/5/
I did try the stacked: true,
for the right-y-axis, but that did not work.我确实尝试了stacked: true,
对于右 y 轴,但这不起作用。 Is it possible to get the same scale on the right anyhow?无论如何,是否有可能在右侧获得相同的比例?
If the data is static as in your code, you can define the options min
and max
on 'right-y-axis'
as follows:如果数据是代码中的 static,您可以在'right-y-axis'
上定义选项min
和max
,如下所示:
'right-y-axis': {
min: 0,
max: 6000,
type: 'linear',
position: 'right',
},
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.