解決echarts報There is a chart instance already initialized on the dom.錯誤


當echarts實例存在時,從柱狀圖切換到餅圖或其他一些圖時,會出錯。
所以要先銷毀這個實例
然后再重新創建

 echarts.init(document.getElementById("echartsTest5")).dispose();//解決echarts dom已經加載的報錯
 myChart = echarts.init(document.getElementById("echartsTest5"));

直接使用mycharts.dispose()無效


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM