NEZ-1768 fix:设置图表最大值最小值展示时有误
This commit is contained in:
@@ -142,8 +142,8 @@ export default {
|
|||||||
return Number(a[0]) - Number(b[0])
|
return Number(a[0]) - Number(b[0])
|
||||||
})
|
})
|
||||||
const valueSorted = datas.sort((a, b) => {
|
const valueSorted = datas.sort((a, b) => {
|
||||||
const a1 = isNaN(a[1]) ? 0 : Number(a[1])
|
const a1 = isNaN(a[1]) && !a[1] ? 0 : Number(a[1])
|
||||||
const b1 = isNaN(b[1]) ? 0 : Number(b[1])
|
const b1 = isNaN(b[1]) && !b[1] ? 0 : Number(b[1])
|
||||||
return a1 - b1
|
return a1 - b1
|
||||||
})
|
})
|
||||||
minTime = timeSorted.length ? timeSorted[0][0] : ''
|
minTime = timeSorted.length ? timeSorted[0][0] : ''
|
||||||
|
|||||||
@@ -205,16 +205,6 @@ export default {
|
|||||||
if (isNaN(result)) {
|
if (isNaN(result)) {
|
||||||
return '--'
|
return '--'
|
||||||
}
|
}
|
||||||
// result = Math.round(num * 100) / 100
|
|
||||||
// let decimal = result.toString()
|
|
||||||
// let posDecimal = decimal.indexOf('.')
|
|
||||||
// if (posDecimal < 0) {
|
|
||||||
// posDecimal = decimal.length
|
|
||||||
// decimal += '.'
|
|
||||||
// }
|
|
||||||
// while (decimal.length <= posDecimal + 2) {
|
|
||||||
// decimal += '0'
|
|
||||||
// }
|
|
||||||
result = chartDataFormat.getUnit(this.chartInfo.unit ? this.chartInfo.unit : 2).compute(result, null, -1, 2)
|
result = chartDataFormat.getUnit(this.chartInfo.unit ? this.chartInfo.unit : 2).compute(result, null, -1, 2)
|
||||||
return result
|
return result
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -908,8 +908,8 @@ export function getMetricTypeValue (queryItem, type) {
|
|||||||
switch (type) {
|
switch (type) {
|
||||||
case 'min': {
|
case 'min': {
|
||||||
let min = copy.sort((x, y) => {
|
let min = copy.sort((x, y) => {
|
||||||
const x1 = isNaN(x[1]) ? 0 : x[1]
|
const x1 = isNaN(x[1]) && !x[1] ? 0 : x[1]
|
||||||
const y1 = isNaN(x[1]) ? 0 : y[1]
|
const y1 = isNaN(y[1]) && !y[1] ? 0 : y[1]
|
||||||
return x1 - y1
|
return x1 - y1
|
||||||
})[0][1]
|
})[0][1]
|
||||||
if (isNaN(min)) {
|
if (isNaN(min)) {
|
||||||
@@ -919,8 +919,8 @@ export function getMetricTypeValue (queryItem, type) {
|
|||||||
}
|
}
|
||||||
case 'max': {
|
case 'max': {
|
||||||
let max = copy.sort((x, y) => {
|
let max = copy.sort((x, y) => {
|
||||||
const x1 = isNaN(x[1]) ? 0 : x[1]
|
const x1 = isNaN(x[1]) && !x[1] ? 0 : x[1]
|
||||||
const y1 = isNaN(x[1]) ? 0 : y[1]
|
const y1 = isNaN(y[1]) && !y[1] ? 0 : y[1]
|
||||||
return y1 - x1
|
return y1 - x1
|
||||||
})[0][1]
|
})[0][1]
|
||||||
if (isNaN(max)) {
|
if (isNaN(max)) {
|
||||||
@@ -930,7 +930,7 @@ export function getMetricTypeValue (queryItem, type) {
|
|||||||
}
|
}
|
||||||
case 'avg': {
|
case 'avg': {
|
||||||
copy = copy.map(t => {
|
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)
|
return parseFloat(t1)
|
||||||
})
|
})
|
||||||
const sum = eval(copy.join('+'))
|
const sum = eval(copy.join('+'))
|
||||||
@@ -947,7 +947,7 @@ export function getMetricTypeValue (queryItem, type) {
|
|||||||
}
|
}
|
||||||
case 'total': {
|
case 'total': {
|
||||||
copy = copy.map(t => {
|
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)
|
return parseFloat(t1)
|
||||||
})
|
})
|
||||||
const total = eval(copy.join('+'))
|
const total = eval(copy.join('+'))
|
||||||
@@ -955,16 +955,16 @@ export function getMetricTypeValue (queryItem, type) {
|
|||||||
}
|
}
|
||||||
case 'range': {
|
case 'range': {
|
||||||
let min = copy.sort((x, y) => {
|
let min = copy.sort((x, y) => {
|
||||||
const x1 = isNaN(x[1]) ? 0 : x[1]
|
const x1 = isNaN(x[1]) && !x[1] ? 0 : x[1]
|
||||||
const y1 = isNaN(x[1]) ? 0 : y[1]
|
const y1 = isNaN(y[1]) && !y[1] ? 0 : y[1]
|
||||||
return x1 - y1
|
return x1 - y1
|
||||||
})[0][1]
|
})[0][1]
|
||||||
if (isNaN(min)) {
|
if (isNaN(min)) {
|
||||||
min = 0
|
min = 0
|
||||||
}
|
}
|
||||||
let max = copy.sort((x, y) => {
|
let max = copy.sort((x, y) => {
|
||||||
const x1 = isNaN(x[1]) ? 0 : x[1]
|
const x1 = isNaN(x[1]) && !x[1] ? 0 : x[1]
|
||||||
const y1 = isNaN(x[1]) ? 0 : y[1]
|
const y1 = isNaN(y[1]) && !y[1] ? 0 : y[1]
|
||||||
return y1 - x1
|
return y1 - x1
|
||||||
})[0][1]
|
})[0][1]
|
||||||
if (isNaN(max)) {
|
if (isNaN(max)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user