/*
 * @Descripttion: 
 * @version: 
 * @Author: ysh
 * @Date: 2022-04-12 01:47:01
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2024-10-11 14:23:57
 */
import * as echarts from 'echarts'
export  function disposeCharts(name) {
  if (name != null && name != "" && name != undefined) {
    name.dispose(); //销毁
  }
};
export  function echartsSetoption(chart, option) {
  chart.setOption(option);
  window.addEventListener("resize", function () {
    chart.resize();
  });
}
export function echartsInit(myCharts,id,options){
  disposeCharts(myCharts);
  let chartDom = document.getElementById(id);
  myCharts = echarts.init(chartDom);
  let option = options;
  echartsSetoption(myCharts, option);
  return myCharts
}