chengwubin commented on issue #4726: echarts内存泄露
URL: 
https://github.com/apache/incubator-echarts/issues/4726#issuecomment-458790885
 
 
   `<!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 = echarts.init(document.getElementById('test'));
     chart.setOption({
         title: {
             text: '模拟数据'
         },
         tooltip: {
             trigger: 'axis',
             axisPointer: {
                 type: 'cross',
                 label: {
                     backgroundColor: '#283b56'
                 }
             }
         },
         legend: {
             data:['最新成交价', '预购队列']
         },
         toolbox: {
             show: true,
             feature: {
                 dataView: {readOnly: false},
                 restore: {},
                 saveAsImage: {}
             }
         },
         dataZoom: {
             show: false,
             start: 0,
             end: 100
         },
         xAxis: [
             {
                 type: 'category',
                 boundaryGap: true,
                 data: (function (){
                     var now = new Date();
                     var res = [];
                     var len = 10;
                     while (len--) {
                         
res.unshift(now.toLocaleTimeString().replace(/^\D*/,''));
                         now = new Date(now - 2000);
                     }
                     return res;
                 })()
             },
             {
                 type: 'category',
                 boundaryGap: true,
                 data: (function (){
                     var res = [];
                     var len = 10;
                     while (len--) {
                         res.push(10 - len - 1);
                     }
                     return res;
                 })()
             }
         ],
         yAxis: [
             {
                 type: 'value',
                 scale: true,
                 name: '价格',
                 max: 30,
                 min: 0,
                 boundaryGap: [0.2, 0.2]
             },
             {
                 type: 'value',
                 scale: true,
                 name: '预购量',
                 max: 1200,
                 min: 0,
                 boundaryGap: [0.2, 0.2]
             }
         ],
         series: [
             {
                 name:'预购队列',
                 type:'bar',
                 xAxisIndex: 1,
                 yAxisIndex: 1,
                 data:(function (){
                     var res = [];
                     var len = 10;
                     while (len--) {
                         res.push(Math.round(Math.random() * 1000));
                     }
                     return res;
                 })()
             },
             {
                 name:'最新成交价',
                 type:'line',
                 data:(function (){
                     var res = [];
                     var len = 0;
                     while (len < 10) {
                         res.push((Math.random()*10 + 5).toFixed(1) - 0);
                         len++;
                     }
                     return res;
                 })()
             }
         ]
     });
   
     var series = chart.getOption().series[0];
     var size = series.data.length;
   
     var index = 0;
     setInterval(function () {
         chart.dispatchAction({
             type: 'showTip',
             seriesIndex: 0,
             dataIndex: index
         });
   
         index = ++index % size;
     }, 2000);
   </script>
   </body>
   </html>`
   
   版本信息:
   chrome:70.0.3538.110(正式版本) (32 位)
   echarts: 4.2.0-rc.2
   
   tooltip轮播功能,内存泄露。
   看图:
   
![image](https://user-images.githubusercontent.com/18694507/51954608-db47bd80-247b-11e9-8d0f-b4ca22d22eed.png)
   
   
![image](https://user-images.githubusercontent.com/18694507/51954667-16e28780-247c-11e9-81d0-e85f297f4e06.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