From 2890eee11dc36640d7a3ac01f7ddc0622b610929 Mon Sep 17 00:00:00 2001 From: zhangyu Date: Thu, 23 Dec 2021 16:06:38 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=20=E4=BF=AE=E6=94=B9=20valiue=20Ma?= =?UTF-8?q?pping=20=E4=B8=8D=E6=98=BE=E7=A4=BA=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/chart/chart/chartGauge.vue | 3 +++ .../common/rightBox/chart/chartConfig.vue | 4 ++-- .../common/rightBox/chart/publicConfig.js | 13 ++++++++++++- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/nezha-fronted/src/components/chart/chart/chartGauge.vue b/nezha-fronted/src/components/chart/chart/chartGauge.vue index ac4b57dc1..5d516c721 100644 --- a/nezha-fronted/src/components/chart/chart/chartGauge.vue +++ b/nezha-fronted/src/components/chart/chart/chartGauge.vue @@ -88,6 +88,9 @@ export default { gauge.value = getMetricTypeValue(data.values, chartInfo.param.statistics || 'last') gauge.max = getMetricTypeValue(data.values, 'max') gauge.min = getMetricTypeValue(data.values, 'min') + if (gauge.min === gauge.max) { + gauge.min = gauge.max / 2 + } gauge.label = data.metric gauge.legend = this.handleLegend(chartInfo, data, expressionIndex, dataIndex, colorIndex).alias gauge.name = this.handleLegend(chartInfo, data, expressionIndex, dataIndex, colorIndex).name diff --git a/nezha-fronted/src/components/common/rightBox/chart/chartConfig.vue b/nezha-fronted/src/components/common/rightBox/chart/chartConfig.vue index 62c8299d1..86c279f97 100644 --- a/nezha-fronted/src/components/common/rightBox/chart/chartConfig.vue +++ b/nezha-fronted/src/components/common/rightBox/chart/chartConfig.vue @@ -508,9 +508,9 @@ > - +
diff --git a/nezha-fronted/src/components/common/rightBox/chart/publicConfig.js b/nezha-fronted/src/components/common/rightBox/chart/publicConfig.js index c8b08d00b..ca8fb48d9 100644 --- a/nezha-fronted/src/components/common/rightBox/chart/publicConfig.js +++ b/nezha-fronted/src/components/common/rightBox/chart/publicConfig.js @@ -399,6 +399,17 @@ export default { this.chartConfig.param.tags = newTags this.chartConfig.param.indexs = newTags.map(item => item.text).join(',') this.change() - } + }, + enableChange (type) { + switch (type) { + case 'valueMapping': + break; + case 'legend': + break; + case '': + break; + } + this.change() + }, } }