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 2019/11/21 09:36:07 UTC

[GitHub] [incubator-echarts] liiiiiiu opened a new issue #11694: vue使用echarts gl内存溢出

liiiiiiu opened a new issue #11694: vue使用echarts gl内存溢出
URL: https://github.com/apache/incubator-echarts/issues/11694
 
 
   Version
   4.5.0
   
   Steps to reproduce
   1.vue两个组件分别引入并使用echarts的3D图表
   2.来回切换这两个组件,使用safari浏览器打开 开发者工具选中canvas
   ![image](https://user-images.githubusercontent.com/26787885/69323967-9ac36580-0c82-11ea-8702-5d3cf12f2a82.png)
   3.重复切换后canvas数量会不断上升,不久就会内存溢出,使用dispose、clear都无效
   4.换成2d图表,使用dispose可以销毁图表,3d的就不行
   
   示例代码
   ```
   <template lang="html">
     <div class="app-container">
       <div ref="chart" style="width: 100%;height: 500px;"></div>
     </div>
   </template>
   
   <script>
   import echarts from 'echarts'
   import 'echarts-gl'
   
   export default {
     data() {
       return {
         myChart: null,
       }
     },
     mounted () {
       this.initChart()
     },
     beforeDestroy() {
       if (!this.myChart) return
       this.myChart.dispose()
       this.myChart = null
     },
     methods: {
       initChart() {
         this.myChart = echarts.init(this.$refs['chart'], {width: 'auto', height: 'auto'})
         let option = {
           grid3D: {},
           tooltip: {},
           xAxis3D: {
               type: 'category'
           },
           yAxis3D: {
               type: 'category'
           },
           zAxis3D: {},
           visualMap: {
               max: 1e8,
               dimension: 'Population'
           },
           dataset: {
               dimensions: [
                   'Income',
                   'Life Expectancy',
                   'Population',
                   'Country',
                   {name: 'Year', type: 'ordinal'}
               ],
               source: []
           },
           series: [
               {
                   type: 'bar3D',
                   // symbolSize: symbolSize,
                   shading: 'lambert',
                   encode: {
                       x: 'Year',
                       y: 'Country',
                       z: 'Life Expectancy',
                       tooltip: [0, 1, 2, 3, 4]
                   }
               }
           ]
         }
         this.myChart.setOption(option);
       }
     }
   }
   </script>
   
   ```

----------------------------------------------------------------
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: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org