From 9512a9ea3dbefbb5dcd24980515814f5fa3ba679 Mon Sep 17 00:00:00 2001 From: zhangyu Date: Wed, 23 Sep 2020 09:41:46 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=E4=BF=AE=E5=A4=8DY=E8=BD=B4?= =?UTF-8?q?=E5=B0=8F=E6=95=B0=20=E6=98=BE=E7=A4=BA=E8=BF=87=E5=A4=9A?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/charts/chartDataFormat.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/nezha-fronted/src/components/charts/chartDataFormat.js b/nezha-fronted/src/components/charts/chartDataFormat.js index 796822fd8..1fbef042e 100644 --- a/nezha-fronted/src/components/charts/chartDataFormat.js +++ b/nezha-fronted/src/components/charts/chartDataFormat.js @@ -19,10 +19,18 @@ function short(value,index,type=1,dot){ } function percent01(value,index){ - return `${value} %`; + let len=JSON.stringify(value); + if(len.length>5){ + len=len.slice(0,5); + } + return `${len} %`; } function percent02(value,index){ - return `${value * 100 } %`; + let len=JSON.stringify(value); + if(len.length>5){ + len=len.slice(0,5); + } + return `${len * 100 } %`; } function localFormat(value,index){ let num = (value || 0).toString();