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) {