echarts定时渲染内存溢出问题处理(echarts渲染刷新导致浏览器卡)
echarts定时渲染地图出现浏览器内存溢出问题(echarts渲染刷新导致浏览器卡)
处理方式:
1)将定时变化的option内容单独提取定时刷新
2)先setOption数据后再clear(),之后再次setOption()
例如:
function Z(data) { var x = 119.557082; var y = 26.659241; var zoom = 14; var points = data || [[]] var chart = echarts.init(document.getElementById("box")); chart.setOption({bmap:[{ center: [x,y], zoom: zoom}], series: [{ type: 'heatmap', coordinateSystem: 'bmap', data: points, pointSize: 5, blurSize: 6 }] },{notMerge: false, lazyUpdate: false, silent:false});
chart.clear(); chart.setOption({bmap:[{ center: [x,y], zoom: zoom}], series: [{ type: 'heatmap', coordinateSystem: 'bmap', data: points, pointSize: 5, blurSize: 6 }] },{notMerge: false, lazyUpdate: false, silent:false}); }
参考
注:可以尝试隔一段时间 【刷新】一次浏览器,由于是谷歌浏览器(没找到清除内存的JS)
感谢:https://blog.csdn.net/wrkd35/article/details/106713987/
https://www.haorooms.com/post/javascript_neicun_use
https://blog.csdn.net/weixin_36413887/article/details/80062144?utm_source=blogxgwz4