javascript - Apex 图表禁用滚动/缩放
我使用 ApexCharts 库创建了一个图表,我想要禁止拖动图表的功能。我应该如何更新我的配置(见下文)?我在文档中找不到相关细节。我的图表是:
//My component
<Chart
options={performanceLineChart.options}
series={performanceLineChart.series}
/>
//My configurations
export const performanceLineChart = {
options: {
chart: {
id: 'my-chart',
type: 'line' as 'line',
toolbar: {
show: false //Disable toolbar
}
},
stroke: {
width: 5,
curve: 'smooth' as 'smooth'
},
markers: {
size: 4,
hover: {
size: undefined,
sizeOffset: 2
}
},
xasis: {
type: 'numeric',
}
},
series: [{
name: 'Line 1',
data: [
[3066, 323],
[6317, 312],
[12498, 313],
[24091, 326]
]
},{
name: 'Line 2',
data: [
[3516, 281],
[7378, 268],
[11502, 344],
[21219, 371]
]
}]
}
答案#1
我猜你在说选择缩放,你可以这样关闭它
chart: {
id: 'my-chart',
type: 'line' as 'line',
toolbar: {
show: false
},
zoom: {
enabled: false,
}
},
答案#2
不确定这些问题是否仍然存在。未来,ApexCharts v3.54.1。请设置 allowMouseWheelZoom: false。
chart: {
id: 'my-chart',
type: 'line' as 'line',
toolbar: {
show: false
},
zoom: {
enabled: false,
allowMouseWheelZoom: false,
}
}
