diff --git a/nezha-fronted/src/components/charts/chart-list.vue b/nezha-fronted/src/components/charts/chart-list.vue index 09cf6a3be..a019249ef 100644 --- a/nezha-fronted/src/components/charts/chart-list.vue +++ b/nezha-fronted/src/components/charts/chart-list.vue @@ -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 = []; diff --git a/nezha-fronted/src/components/common/rightBox/cabinetBox.vue b/nezha-fronted/src/components/common/rightBox/cabinetBox.vue index 2c66b4469..606a76947 100644 --- a/nezha-fronted/src/components/common/rightBox/cabinetBox.vue +++ b/nezha-fronted/src/components/common/rightBox/cabinetBox.vue @@ -202,9 +202,5 @@ } } - -