perf: echarts性能优化

This commit is contained in:
chenjinsong
2020-09-25 20:17:29 +08:00
parent c968c4cefc
commit 47a5fd18f8
5 changed files with 28 additions and 70 deletions

View File

@@ -1119,14 +1119,10 @@
}
},
computeDistance:function(str){
var width = 0;
var html = document.createElement('span');
html.innerText = str;
html.className = 'getTextWidth';
document.querySelector('body').appendChild(html);
width = document.querySelector('.getTextWidth').offsetWidth;
document.querySelector('.getTextWidth').remove();
return Number('-'+(width+5));
let span = document.querySelector(".temp-dom");
span.textContent = str;
let txtWidth = parseFloat(window.getComputedStyle(span).width);
return Number('-'+(txtWidth+5));
},
modelStaticData(chartInfo, filterType) {
let series = [];