You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by GitBox <gi...@apache.org> on 2020/10/25 18:59:31 UTC

[GitHub] [incubator-echarts] PROLANGtest commented on issue #6202: Problems when updating chart through echartsInstance.setOption()

PROLANGtest commented on issue #6202:
URL: https://github.com/apache/incubator-echarts/issues/6202#issuecomment-716194704


   SOLVED in Angular 9 - but I did it differently - you can update the chart with echarts.init(this.MyChart);  
   The problem seems to stem from the lag between the time the DOM element actually renders or fetches the <canvas> element.
   
   1. First get the parent.
   2. Wait a little - get the <canvas> 
   3. Re-Initiate the canvas
   4. setOption
   
   CODE:
   
      let parent = document.getElementsByClassName('gaugeChart')[0];
       setTimeout(() => {
         this.MyChartCanvas = parent.querySelector('canvas');
       }, 100);
   
         echarts.init(this.MyChartCanvas);
   
         let myChart = echarts.getInstanceByDom(this.MyChartCanvas);
         myChart.setOption(this.doughnutChartOption, true);
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org