首页 > 其他分享 >使用echarts防止出现“There is a chart instance already initialized on the dom.”的警告

使用echarts防止出现“There is a chart instance already initialized on the dom.”的警告

时间:2023-03-23 10:35:12浏览次数:38  
标签:already dom There myChart instance && echarts

var myChart;
function historyMapInit(query_date) {
    //防止出现“There is a chart instance already initialized on the dom.”的警告
    //在使用echarts发现需要及时对新建的myChart实例进行销毁,否则会出现上述警告
    console.log(myChart != null && myChart != "" && myChart != undefined);
    if (myChart != null && myChart != "" && myChart != undefined) {
        myChart.dispose();
    }
   myChart = echarts.init(document.getElementById('result_monthtotle_maps_id'));
}

  

标签:already,dom,There,myChart,instance,&&,echarts
From: https://www.cnblogs.com/henuyuxiang/p/17246539.html

相关文章