最近研究了echarts,发现重新加载不重新绘图的问题,找了一下问题的根源所在,大概如下:

解决方案:
因为echarts绘制都要创建一个Echarts实例,返回echartsInstance。所以我们只需要在重新创建的时候,移除之前创建的实例并且重新创建一个Echarts实例:

document.getElementById('main').removeAttribute('_echarts_instance_'); // 移除容器上的 _echarts_instance_ 属性

关于echarts加载重绘问题
重新创建:

let myChart = echarts.init(document.getElementById('main'));
myChart.setOption(option,true);

相关链接:
Echarts.js:https://www.echartsjs.com/index.html

相关文章:

  • 2021-05-28
  • 2022-12-23
  • 2021-06-20
  • 2021-10-17
  • 2021-12-04
  • 2022-12-23
  • 2021-10-12
猜你喜欢
  • 2022-12-23
  • 2021-12-24
  • 2022-12-23
  • 2022-01-20
  • 2022-12-23
  • 2021-11-03
  • 2022-12-23
相关资源
相似解决方案