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

发布时间 2023-03-23 10:33:19作者: 岁月淡忘了谁
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'));
}