You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@echarts.apache.org by GitBox <gi...@apache.org> on 2019/04/26 16:54:42 UTC

[GitHub] [incubator-echarts] mikias10 edited a comment on issue #7483: Resize multiple charts

mikias10 edited a comment on issue #7483: Resize multiple charts
URL: https://github.com/apache/incubator-echarts/issues/7483#issuecomment-487126338
 
 
   I was having the same issue. But there was flebox container. As a solution, during initialization, I stored each chart  to `charts` array.  And, on `window.resize()` , I looped the array and invoked `resize()` on each chart object.
   
   ```
     charts: [],
     initalizeChart(data) {
       const values = [];
       const timestamps = [];
       const self = this;
   
       data.forEach((item) => {
         values.push(item.value);
         timestamps.push(item.timestamp);
       });
   
       const option = this.setupOptions(values, timestamps);
       const chart = document.querySelector(`#${this.elementId} .chart`);
       _const myChart = window.echarts.init(chart);
   
       self.charts.push(myChart);_
   
       _window.onresize = function() {
         self.charts.forEach((obj) => {
           obj.resize();
         });
       };_
   
       myChart.setOption(option);
     },
   ```

----------------------------------------------------------------
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


With regards,
Apache Git Services

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