From 670a5759c25c65a36b703ca7a548fbf883402ae2 Mon Sep 17 00:00:00 2001 From: wangwenrui Date: Thu, 16 Jul 2020 16:03:45 +0800 Subject: [PATCH] =?UTF-8?q?perf:=E4=BC=98=E5=8C=96=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E5=8C=96=E8=AE=A1=E7=AE=97=E6=96=B9=E5=BC=8F?= =?UTF-8?q?=EF=BC=8C=E7=AE=80=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/charts/chartDataFormat.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/nezha-fronted/src/components/charts/chartDataFormat.js b/nezha-fronted/src/components/charts/chartDataFormat.js index c42011589..c5bfb3bdb 100644 --- a/nezha-fronted/src/components/charts/chartDataFormat.js +++ b/nezha-fronted/src/components/charts/chartDataFormat.js @@ -3,7 +3,9 @@ * index:yAxis 默认第二个参数 y轴的位置 * type:自定义参数,用于区分是y轴调用还是tooltip调用,以设置不同精度 type =1 y轴调用 type=2 tooltip调用 * */ -function none(value,index){ +import {parse} from "echarts/extension-src/dataTool/gexf"; + +function none(value, index){ return value; } function short(value,index,type=1){ @@ -255,6 +257,16 @@ function days(value,index,type=1){ * unitIndex:不需要传递,用于递归获取units中的单位 * */ function asciiCompute(num,ascii,units,dot=2,unitIndex=0){ + num=Number(num) + let carry=0; + if(num > 0){ + let log=Math.log(num)/Math.log(ascii) + carry = parseInt(log) + num = num / Math.pow(ascii,carry) + } + return num.toFixed(dot) +' '+units[carry]; +} +function asciiCompute2(num,ascii,units,dot=2,unitIndex=0){ num=Number(num) let quotient=num / ascii; if(unitIndex <= units.length-1){