如何让Apache ECharts仪表盘图表不可点击?
禁用Apache ECharts仪表盘的轴线点击交互
要禁用仪表盘圆形轴线的点击交互,只需在你的gauge系列配置中添加silent: true属性即可。这个属性会关闭该系列的所有鼠标交互事件(包括点击、悬浮等),完全适配你仅做展示的需求。
修改后的完整配置代码如下:
const option = { series: [ { data: gaugeData, type: 'gauge', silent: true, // 新增此行,禁用该系列所有交互 startAngle: 90, endAngle: -270, min: 0, max: 100, progress: { show: true, width: 10, roundCap: true, }, pointer: { show: false, }, axisLine: { lineStyle: { width: 10, }, }, axisTick: { show: false, }, splitLine: { show: false, }, axisLabel: { show: false, }, title: { show: false, }, itemStyle: { color: '#ee6666', }, detail: { formatter: '{value}', color: 'auto', offsetCenter: [0, '-0%'], valueAnimation: true, fontSize: 34, }, }, ], };
silent是ECharts系列通用配置项,设为true后,该系列的图形元素将不再响应任何鼠标事件,刚好解决你不需要点击交互的场景。
内容的提问来源于stack exchange,提问作者TinyTiger
相关产品推荐
相关产品推荐

