问题描述
echarts版本:5.4.3
当树状图中,图形数量增多,超过默认值 animationThreshold: 2000
,或者 animation
属性为 False
时,都会导致动画关闭。这时,如果点击一个节点收缩子树,节点会消失,而线还在。
解决方法
经查阅,该问题属于 echarts 树状图的bug,且暂未解决,采取如下方式绕开:
-
将
animation
设为True (默认值)
,animationThreshold
属性设置为大于图形元素数量的值,确保动画一直处于开启状态。const chartDom = document.getElementById("main-graph"); myChart = echarts.init(chartDom); myChart.setOption({ series: [ { id: "main", type: "tree", data, layout: "radial", symbol: "emptyCircle", }, ], animationThreshold: 200000 });
-
或者,将 echarts 库降级到 4.x.x 版本。
参考
[Bug] Links still exists after collapse the node on Tree with large data #17266