NEZ-1768 fix:设置图表最大值最小值展示时有误

This commit is contained in:
zhangyu
2022-04-01 18:21:55 +08:00
parent 02800e765f
commit f3d9962f61
3 changed files with 12 additions and 22 deletions

View File

@@ -908,8 +908,8 @@ export function getMetricTypeValue (queryItem, type) {
switch (type) {
case 'min': {
let min = copy.sort((x, y) => {
const x1 = isNaN(x[1]) ? 0 : x[1]
const y1 = isNaN(x[1]) ? 0 : y[1]
const x1 = isNaN(x[1]) && !x[1] ? 0 : x[1]
const y1 = isNaN(y[1]) && !y[1] ? 0 : y[1]
return x1 - y1
})[0][1]
if (isNaN(min)) {
@@ -919,8 +919,8 @@ export function getMetricTypeValue (queryItem, type) {
}
case 'max': {
let max = copy.sort((x, y) => {
const x1 = isNaN(x[1]) ? 0 : x[1]
const y1 = isNaN(x[1]) ? 0 : y[1]
const x1 = isNaN(x[1]) && !x[1] ? 0 : x[1]
const y1 = isNaN(y[1]) && !y[1] ? 0 : y[1]
return y1 - x1
})[0][1]
if (isNaN(max)) {
@@ -930,7 +930,7 @@ export function getMetricTypeValue (queryItem, type) {
}
case 'avg': {
copy = copy.map(t => {
const t1 = isNaN(t[1]) ? 0 : t[1]
const t1 = isNaN(t[1]) && !t[1] ? 0 : t[1]
return parseFloat(t1)
})
const sum = eval(copy.join('+'))
@@ -947,7 +947,7 @@ export function getMetricTypeValue (queryItem, type) {
}
case 'total': {
copy = copy.map(t => {
const t1 = isNaN(t[1]) ? 0 : t[1]
const t1 = isNaN(t[1]) && !t[1] ? 0 : t[1]
return parseFloat(t1)
})
const total = eval(copy.join('+'))
@@ -955,16 +955,16 @@ export function getMetricTypeValue (queryItem, type) {
}
case 'range': {
let min = copy.sort((x, y) => {
const x1 = isNaN(x[1]) ? 0 : x[1]
const y1 = isNaN(x[1]) ? 0 : y[1]
const x1 = isNaN(x[1]) && !x[1] ? 0 : x[1]
const y1 = isNaN(y[1]) && !y[1] ? 0 : y[1]
return x1 - y1
})[0][1]
if (isNaN(min)) {
min = 0
}
let max = copy.sort((x, y) => {
const x1 = isNaN(x[1]) ? 0 : x[1]
const y1 = isNaN(x[1]) ? 0 : y[1]
const x1 = isNaN(x[1]) && !x[1] ? 0 : x[1]
const y1 = isNaN(y[1]) && !y[1] ? 0 : y[1]
return y1 - x1
})[0][1]
if (isNaN(max)) {