From 95a0ca75c4e6bd24786880ecfa8f795e8a7fda47 Mon Sep 17 00:00:00 2001 From: zhangyu Date: Wed, 23 Aug 2023 10:30:44 +0800 Subject: [PATCH] =?UTF-8?q?NEZ-3116=20fix=EF=BC=9ADashboard=E4=B8=AD?= =?UTF-8?q?=E5=88=9B=E5=BB=BA=E5=9B=BE=E8=A1=A8=E4=BD=BF=E7=94=A8=E5=8F=8C?= =?UTF-8?q?Y=E8=BD=B4=E6=97=B6=EF=BC=8CLegend=E7=9A=84Values=E4=B8=8D?= =?UTF-8?q?=E4=B8=BA=E7=A9=BA=E6=97=B6=EF=BC=8C=E5=9B=BE=E8=A1=A8=E4=B8=AD?= =?UTF-8?q?Value=E5=80=BC=E4=B8=8D=E6=AD=A3=E7=A1=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nezha-fronted/src/components/chart/chart/legend.vue | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/nezha-fronted/src/components/chart/chart/legend.vue b/nezha-fronted/src/components/chart/chart/legend.vue index be0bb04f9..028f35d23 100644 --- a/nezha-fronted/src/components/chart/chart/legend.vue +++ b/nezha-fronted/src/components/chart/chart/legend.vue @@ -40,7 +40,7 @@ {{item.alias ? item.alias : item.name}} -
{{(keepTwoDecimalFull(statistics.value))}}
+
{{(keepTwoDecimalFull(statistics.value, 'right'))}}
@@ -243,12 +243,16 @@ export default { this.$emit('clickLegendD3', this.isGrey) }, // 四舍五入保留2位小数(不够位数,则用0替补) - keepTwoDecimalFull (num) { + keepTwoDecimalFull (num, type = 'left') { + let chartUnit = this.chartInfo.unit + if (type === 'right') { + chartUnit = this.chartInfo.param.rightYAxis.unit + } let result = parseFloat(num) if (isNaN(result)) { return '--' } - result = chartDataFormat.getUnit(this.chartInfo.unit ? this.chartInfo.unit : 2).compute(result, null, -1, 2) + result = chartDataFormat.getUnit(chartUnit || 2).compute(result, null, -1, 2) return result }, getMaxValue (dataArg, chartInfo) {