chengwubin edited a comment on issue #4726: echarts内存泄露
URL: 
https://github.com/apache/incubator-echarts/issues/4726#issuecomment-458798814
 
 
   ## 使用clear清除数据后循环设置option
   ```
   <!DOCTYPE html>
   <html lang="en">
   <head>
     <meta charset="UTF-8">
     <title>内存泄漏</title>
   </head>
   <body>
   <div id="test" style="width: 500px; height: 300px;"></div>
   <script 
src="https://cdn.bootcss.com/echarts/4.2.0-rc.2/echarts.min.js";></script>
   <script>
     var chart = null;
     function createChart() {
         chart = echarts.init(document.getElementById('test'));
         chart.setOption({
             xAxis: {
                 type: 'category',
                 data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
             },
             yAxis: {
                 type: 'value'
             },
             series: [{
                 data: [820, 932, 901, 934, 1290, 1330, 1320],
                 type: 'line'
             }]
         });
     }
   
     createChart();
     setInterval(function () {
         chart.clear();
         chart.setOption({
             xAxis: {
                 type: 'category',
                 data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
             },
             yAxis: {
                 type: 'value'
             },
             series: [{
                 data: [820, 932, 901, 934, 1290, 1330, 1320],
                 type: 'line'
             }]
         });
     }, 3000);
   </script>
   </body>
   </html>
   ```
   
   版本信息:
   chrome:70.0.3538.110(正式版本) (32 位)
   echarts: 4.2.0-rc.2
   
   
![image](https://user-images.githubusercontent.com/18694507/51956406-79d71d00-2482-11e9-931c-41763c7550e1.png)
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to