当我缩放时间序列图表时,有没有办法禁用 y 轴的自动缩放?
您可以在此处观察行为:https://codesandbox.io/s/react-chartjs-2-line-zoom-pan-9cz0eh 当您缩放时,y 轴将缩放,以便数据占据所有 y 轴空间。
我的缩放插件如下所示:
plugins = Object.assign({
"title": {
display: true,
text: title,
align: "start"
},
"legend": {
position: "bottom",
},
"zoom": {
zoom: {
wheel: {
enabled: true,
},
pinch: {
enabled: true
},
mode: 'x',
},
pan: {
enabled: true,
mode: 'x',
}
}, ect ...
)}
然后我的插件变量存储在 options 中,我像这样返回我的图表:
return (
)
我在文档中发现,您可以为 y 轴设置最小/最大值,并且您可以使用它来获得固定轴,但这对我来说不适用,因为我事先不知道我显示的数据是什么,组件是用来显示多个图表的
Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号