echarts通用

  draw_chart(id) {
   let myCharts = this.$echarts.getInstanceByDom(document.getElementById(id))
   if (myCharts == null) {
    myCharts = this.$echarts.init(document.getElementById(id))
   }
   let charts = new Object()
   switch (id) {
    case 'anomaly_state':
     charts = JSON.parse(JSON.stringify(this.charts_data))
     break
   }
   let option = curveOption(charts)
   myCharts.setOption(option, true)
   window.addEventListener('resize', () => {
    myCharts.resize()
   })
  }

 

posted @ 2023-05-25 15:57  yw3692582  阅读(8)  评论(0编辑  收藏  举报