diff --git a/nezha-fronted/src/components/chart/chart/chartGauge.vue b/nezha-fronted/src/components/chart/chart/chartGauge.vue
index 4fb45ed0b..92e6984f0 100644
--- a/nezha-fronted/src/components/chart/chart/chartGauge.vue
+++ b/nezha-fronted/src/components/chart/chart/chartGauge.vue
@@ -93,8 +93,8 @@ export default {
}
}
gauge.value = getMetricTypeValue(data.values, chartInfo.param.statistics || 'last')
- gauge.max = getMetricTypeValue(data.values, 'max')
- gauge.min = getMetricTypeValue(data.values, 'min')
+ gauge.max = chartInfo.param.max || 100
+ gauge.min = chartInfo.param.min || 0
if (gauge.min === gauge.max) {
gauge.min = gauge.max / 2
}
diff --git a/nezha-fronted/src/components/common/rightBox/chart/chartConfig.vue b/nezha-fronted/src/components/common/rightBox/chart/chartConfig.vue
index 19398549c..a63cd43c0 100644
--- a/nezha-fronted/src/components/common/rightBox/chart/chartConfig.vue
+++ b/nezha-fronted/src/components/common/rightBox/chart/chartConfig.vue
@@ -328,6 +328,26 @@
+
+
+
+
+
+
+
+
+
+
@@ -657,6 +677,7 @@ import chartTypeShow from '@/components/common/rightBox/chart/chartTypeShow'
import VueTagsInput from '@johmun/vue-tags-input'
import draggable from 'vuedraggable'
import { randomcolor, ColorReverse } from '@/components/common/js/radomcolor/randomcolor'
+import { isGauge } from '@/components/chart/chart/tools'
export default {
name: 'chartConfig',
@@ -735,6 +756,7 @@ export default {
}
},
methods: {
+ isGauge,
beforeInit () {
this.promqlType = this.type
this.chartTypeList = this[this.type + 'ChartTypeList']
@@ -772,7 +794,7 @@ export default {
legend: true,
valueMapping: false,
thresholds: false
- },
+ }
}
this.$nextTick(() => {
this.chartConfig.param.thresholds.push({ value: undefined, color: randomcolor() })
@@ -791,6 +813,8 @@ export default {
statistics: 'last',
text: 'value',
valueMapping: [],
+ min: 0,
+ max: 100,
enable: {
legend: true,
valueMapping: false,
diff --git a/nezha-fronted/src/components/common/rightBox/chart/chartRightBox.vue b/nezha-fronted/src/components/common/rightBox/chart/chartRightBox.vue
index 1fd86936e..a4e63d55f 100644
--- a/nezha-fronted/src/components/common/rightBox/chart/chartRightBox.vue
+++ b/nezha-fronted/src/components/common/rightBox/chart/chartRightBox.vue
@@ -201,6 +201,10 @@ export default {
if (!params.groupId) {
params.groupId = 0
}
+ if (params.type !== 'guage') {
+ delete params.param.min
+ delete params.param.max
+ }
if (!params.x && !params.y) {
params.x = this.chartLastPosition.x + params.span > 12 ? 0 : this.chartLastPosition.x
params.y = this.chartLastPosition.y + 12
@@ -284,6 +288,8 @@ export default {
height: 4,
unit: 2,
type: 'line',
+ min: 0,
+ max: 100,
elements: [{ expression: '', legend: '', type: 'expert', id: '', name: 'A' }],
param: {
stack: 0,
@@ -328,6 +334,8 @@ export default {
nullType: 'null',
statistics: 'last',
text: 'value',
+ min: 0,
+ max: 100,
enable: {
thresholds: false,
legend: true,
@@ -413,6 +421,12 @@ export default {
if (this.editChart.groupId === -1) {
this.editChart.groupId = ''
}
+ if (!this.editChart.param.min) {
+ this.editChart.param.min = 0
+ }
+ if (!this.editChart.param.max) {
+ this.editChart.param.max = 100
+ }
}
},
'editChart.type': {
diff --git a/nezha-fronted/src/components/common/rightBox/chart/systemChartConfig.vue b/nezha-fronted/src/components/common/rightBox/chart/systemChartConfig.vue
index 8995146ad..08edca506 100644
--- a/nezha-fronted/src/components/common/rightBox/chart/systemChartConfig.vue
+++ b/nezha-fronted/src/components/common/rightBox/chart/systemChartConfig.vue
@@ -233,6 +233,26 @@
+
+
+
+
+
+
+
+
+
+