echarts 報錯 should not be called during main process


原因是,在循環渲染多個圖表的時候,渲染的圖表和數據有先后順序,有時候出現對應不上的情況,可能是數據已經好了,圖表要渲染慢一些

導致這個問題

解決就是,放在定時器中,比如,我這個是在渲染之后,進行resize,那么就需要將option和resize放在一個定時器中,保持在同一個隊列

 chartInit(chart) {
      let this_ = this;
      if(this.chart){
        this.chart.clear();
      }else{
        this.chart = this.$refs.chart;
      }; 
     
      // must resize chart in nextTick
      this.$nextTick(() => {
        setTimeout(()=>{
          this_.options = ChartConfig(this_.chartData,this_.chartType);
          this_.resizeChart();
        },300);
      });
 },

resizeChart() {
      this.chart && this.chart.resize();
},

 


免責聲明!

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



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