我正在使用 eCharts 生成图表。我使用 eCharts 的
setOption
方法根据缩放级别启用/禁用标签,代码如下:
myChart.on("graphRoam", () => {
const customOptions = myChart.getOption();
if (
customOptions.series[0].zoom >= showLabelsAtZoomLevel &&
!customOptions.series[0].label.show
) {
customOptions.series[0].label.show = true;
myChart.setOption(customOptions, {
notMerge: {
silent: true,
},
lazyUpdate: true,
});
} else if (
customOptions.series[0].zoom < showLabelsAtZoomLevel &&
customOptions.series[0].label.show
) {
customOptions.series[0].label.show = false;
myChart.setOption(customOptions, {
notMerge: {
silent: true,
},
});
}
})
越过
showLabelsAtZoomLevel
阈值时,图形会奇怪地动画化到画布中。请查看此放大和缩小动画的视频示例。
我已经尝试使用 `myChart.setOption({animation: false}) 将
animation
设置为 false,但没有产生丰硕的结果。