perf:图表阈值label计算方式优化

This commit is contained in:
wangwenrui
2020-05-28 18:53:41 +08:00
parent 764eb82bd7
commit 371d6e4a20
2 changed files with 10 additions and 9 deletions

View File

@@ -1135,10 +1135,15 @@ export default {
}
}
},
computeDistance:function(value){
let temp=value+'';
let length=temp.length *12 -20;
return Number('-'+length)
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);
},
modelStaticData(chartInfo, filterType) {
let series = [];