diff --git a/nezha-fronted/src/components/charts/chartPreview.vue b/nezha-fronted/src/components/charts/chartPreview.vue
index efa8ab19b..aad43b80c 100644
--- a/nezha-fronted/src/components/charts/chartPreview.vue
+++ b/nezha-fronted/src/components/charts/chartPreview.vue
@@ -924,6 +924,7 @@ export default {
formatter: function (params) {
let str = '
'
let sum = 0
+ let showFlag = false
params.forEach((item, i) => {
const tip = legend[item.seriesIndex]
const color = self.bgColorList[item.seriesIndex]
@@ -934,6 +935,10 @@ export default {
[tData.getHours(), tData.getMinutes(), tData.getSeconds()].join(':')
str += '
'
}
+ showFlag = showFlag || item.data[1]
+ if (isNaN(item.data[1] + '')) {
+ return
+ }
const val = formatScientificNotation(item.data[1], 2)
sum += isNaN(self.numberWithEConvent(val)) ? 0 : Number(self.numberWithEConvent(val))
str += '
'
@@ -960,7 +965,11 @@ export default {
str += '
'
}
str += '
'
- return str
+ if (!showFlag) {
+ return ''
+ } else {
+ return str
+ }
}
},
legend: {
diff --git a/nezha-fronted/src/components/charts/line-chart-block.vue b/nezha-fronted/src/components/charts/line-chart-block.vue
index 5ebe40687..e53b2c8b1 100644
--- a/nezha-fronted/src/components/charts/line-chart-block.vue
+++ b/nezha-fronted/src/components/charts/line-chart-block.vue
@@ -813,6 +813,7 @@ export default {
formatter: function (params) {
let str = ''
let sum = 0
+ let showFlag = false
let minusFlag = true
params.forEach((item, i) => {
const tip = legend[item.seriesIndex]
@@ -835,6 +836,10 @@ export default {
str += '
'
minusFlag = false
}
+ showFlag = showFlag || item.data[1]
+ if (isNaN(item.data[1] + '')) {
+ return
+ }
const previousItem = params.find((series) => ('Previous ' + item.seriesName) === series.seriesName)
let paramsDot = bus.countDecimals(item.data[1])
if (paramsDot < self.chartDot) {
@@ -887,7 +892,11 @@ export default {
}
str += ''
- return str
+ if (!showFlag) {
+ return ''
+ } else {
+ return str
+ }
}
},
legend: {
@@ -1004,11 +1013,11 @@ export default {
series: dataArg
}
if (!maxValueCopies.copies) {
- option.yAxis.min = 0
- option.yAxis.max = 1
- } else {
- option.yAxis.max = undefined
- }
+ option.yAxis.min = 0
+ option.yAxis.max = 1
+ } else {
+ option.yAxis.max = undefined
+ }
if (unit.type == 'Time') {
delete option.yAxis.maxInterval
}
@@ -1127,6 +1136,7 @@ export default {
formatter: function (params) {
let str = ''
let sum = 0
+ let showFlag = false
params.forEach((item, i) => {
const tip = self.legendMagicType[item.seriesIndex]
const color = self.bgColorList[item.seriesIndex]
@@ -1141,6 +1151,10 @@ export default {
str += bus.timeFormate(tData)
str += '
'
}
+ showFlag = showFlag || item.data[1]
+ if (isNaN(item.data[1] + '')) {
+ return
+ }
const val = formatScientificNotation(item.data[1], 2)
sum += isNaN(self.numberWithEConvent(val)) ? 0 : Number(self.numberWithEConvent(val))
str += ''
@@ -1163,7 +1177,11 @@ export default {
}
str += '
'
- return str
+ if (!showFlag) {
+ return ''
+ } else {
+ return str
+ }
}
}
})
@@ -1295,6 +1313,7 @@ export default {
formatter: function (params) {
let str = ''
let sum = 0
+ let showFlag = false
let minusFlag = true
params.forEach((item, i) => {
const tip = self.legendMagicType[item.seriesIndex]
@@ -1317,6 +1336,10 @@ export default {
str += '
'
minusFlag = false
}
+ showFlag = showFlag || item.data[1]
+ if (isNaN(item.data[1] + '')) {
+ return
+ }
const previousItem = params.find((series) => ('Previous ' + item.seriesName) === series.seriesName)
const val = formatScientificNotation(item.data[1], 2)
sum += isNaN(self.numberWithEConvent(val)) ? 0 : Number(self.numberWithEConvent(val))
@@ -1373,7 +1396,11 @@ export default {
}
str += ''
- return str
+ if (!showFlag) {
+ return ''
+ } else {
+ return str
+ }
}
}
})
@@ -1918,11 +1945,11 @@ export default {
}
}
if (!maxValueCopies.copies) {
- option.yAxis.min = 0
- option.yAxis.max = 1
- } else {
- option.yAxis.max = undefined
- }
+ option.yAxis.min = 0
+ option.yAxis.max = 1
+ } else {
+ option.yAxis.max = undefined
+ }
if (unit.type == 'Time' || option.yAxis.maxInterval === 1) {
delete option.yAxis.maxInterval
}
@@ -1965,11 +1992,11 @@ export default {
}
}
if (!maxValueCopies.copies) {
- option.yAxis.min = 0
- option.yAxis.max = 1
- } else {
- option.yAxis.max = undefined
- }
+ option.yAxis.min = 0
+ option.yAxis.max = 1
+ } else {
+ option.yAxis.max = undefined
+ }
if (unit.type == 'Time' || option.yAxis.maxInterval === 1) {
delete option.yAxis.maxInterval
}
diff --git a/nezha-fronted/src/components/page/dashboard/overview/chart.vue b/nezha-fronted/src/components/page/dashboard/overview/chart.vue
index e8a55d15b..366ca35f1 100644
--- a/nezha-fronted/src/components/page/dashboard/overview/chart.vue
+++ b/nezha-fronted/src/components/page/dashboard/overview/chart.vue
@@ -413,6 +413,7 @@ export default {
return params.title
},
defaultTooltipFormatter: function (params) {
+ let showFlag = false
let minusFlag = true
let str = ''
params instanceof Array || (params = [params])
@@ -436,6 +437,10 @@ export default {
str += '
'
minusFlag = false
}
+ showFlag = showFlag || item.data[1]
+ if (isNaN(item.data[1] + '')) {
+ return
+ }
const val = Number(item.data[1])
str += '
'
str += `
${alias || item.seriesName}:
`
@@ -472,7 +477,11 @@ export default {
str += '
'
})
str += '
'
- return str
+ if (!showFlag) {
+ return ''
+ } else {
+ return str
+ }
},
queryAlias: function (i) {
let alias = null