NEZ-1328 fix: line-chart 数值为null时不显示tooltip
This commit is contained in:
@@ -924,6 +924,7 @@ export default {
|
|||||||
formatter: function (params) {
|
formatter: function (params) {
|
||||||
let str = '<div>'
|
let str = '<div>'
|
||||||
let sum = 0
|
let sum = 0
|
||||||
|
let showFlag = false
|
||||||
params.forEach((item, i) => {
|
params.forEach((item, i) => {
|
||||||
const tip = legend[item.seriesIndex]
|
const tip = legend[item.seriesIndex]
|
||||||
const color = self.bgColorList[item.seriesIndex]
|
const color = self.bgColorList[item.seriesIndex]
|
||||||
@@ -934,6 +935,10 @@ export default {
|
|||||||
[tData.getHours(), tData.getMinutes(), tData.getSeconds()].join(':')
|
[tData.getHours(), tData.getMinutes(), tData.getSeconds()].join(':')
|
||||||
str += '<br/>'
|
str += '<br/>'
|
||||||
}
|
}
|
||||||
|
showFlag = showFlag || item.data[1]
|
||||||
|
if (isNaN(item.data[1] + '')) {
|
||||||
|
return
|
||||||
|
}
|
||||||
const val = formatScientificNotation(item.data[1], 2)
|
const val = formatScientificNotation(item.data[1], 2)
|
||||||
sum += isNaN(self.numberWithEConvent(val)) ? 0 : Number(self.numberWithEConvent(val))
|
sum += isNaN(self.numberWithEConvent(val)) ? 0 : Number(self.numberWithEConvent(val))
|
||||||
str += '<div style="white-space:nowrap;overflow-x:hidden;text-overflow:ellipsis;display: flex; justify-content: space-between; min-width: 150px; max-width: 600px; line-height: 18px; font-size: 12px;">'
|
str += '<div style="white-space:nowrap;overflow-x:hidden;text-overflow:ellipsis;display: flex; justify-content: space-between; min-width: 150px; max-width: 600px; line-height: 18px; font-size: 12px;">'
|
||||||
@@ -960,8 +965,12 @@ export default {
|
|||||||
str += '</div>'
|
str += '</div>'
|
||||||
}
|
}
|
||||||
str += '</div>'
|
str += '</div>'
|
||||||
|
if (!showFlag) {
|
||||||
|
return ''
|
||||||
|
} else {
|
||||||
return str
|
return str
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
legend: {
|
legend: {
|
||||||
show: false
|
show: false
|
||||||
|
|||||||
@@ -813,6 +813,7 @@ export default {
|
|||||||
formatter: function (params) {
|
formatter: function (params) {
|
||||||
let str = '<div>'
|
let str = '<div>'
|
||||||
let sum = 0
|
let sum = 0
|
||||||
|
let showFlag = false
|
||||||
let minusFlag = true
|
let minusFlag = true
|
||||||
params.forEach((item, i) => {
|
params.forEach((item, i) => {
|
||||||
const tip = legend[item.seriesIndex]
|
const tip = legend[item.seriesIndex]
|
||||||
@@ -835,6 +836,10 @@ export default {
|
|||||||
str += '</div>'
|
str += '</div>'
|
||||||
minusFlag = false
|
minusFlag = false
|
||||||
}
|
}
|
||||||
|
showFlag = showFlag || item.data[1]
|
||||||
|
if (isNaN(item.data[1] + '')) {
|
||||||
|
return
|
||||||
|
}
|
||||||
const previousItem = params.find((series) => ('Previous ' + item.seriesName) === series.seriesName)
|
const previousItem = params.find((series) => ('Previous ' + item.seriesName) === series.seriesName)
|
||||||
let paramsDot = bus.countDecimals(item.data[1])
|
let paramsDot = bus.countDecimals(item.data[1])
|
||||||
if (paramsDot < self.chartDot) {
|
if (paramsDot < self.chartDot) {
|
||||||
@@ -887,8 +892,12 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
str += '</div>'
|
str += '</div>'
|
||||||
|
if (!showFlag) {
|
||||||
|
return ''
|
||||||
|
} else {
|
||||||
return str
|
return str
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
legend: {
|
legend: {
|
||||||
show: false
|
show: false
|
||||||
@@ -1127,6 +1136,7 @@ export default {
|
|||||||
formatter: function (params) {
|
formatter: function (params) {
|
||||||
let str = '<div>'
|
let str = '<div>'
|
||||||
let sum = 0
|
let sum = 0
|
||||||
|
let showFlag = false
|
||||||
params.forEach((item, i) => {
|
params.forEach((item, i) => {
|
||||||
const tip = self.legendMagicType[item.seriesIndex]
|
const tip = self.legendMagicType[item.seriesIndex]
|
||||||
const color = self.bgColorList[item.seriesIndex]
|
const color = self.bgColorList[item.seriesIndex]
|
||||||
@@ -1141,6 +1151,10 @@ export default {
|
|||||||
str += bus.timeFormate(tData)
|
str += bus.timeFormate(tData)
|
||||||
str += '</div>'
|
str += '</div>'
|
||||||
}
|
}
|
||||||
|
showFlag = showFlag || item.data[1]
|
||||||
|
if (isNaN(item.data[1] + '')) {
|
||||||
|
return
|
||||||
|
}
|
||||||
const val = formatScientificNotation(item.data[1], 2)
|
const val = formatScientificNotation(item.data[1], 2)
|
||||||
sum += isNaN(self.numberWithEConvent(val)) ? 0 : Number(self.numberWithEConvent(val))
|
sum += isNaN(self.numberWithEConvent(val)) ? 0 : Number(self.numberWithEConvent(val))
|
||||||
str += '<div style="white-space:nowrap;overflow-x:hidden;text-overflow:ellipsis;display: flex; justify-content: space-between; min-width: 150px; max-width: 600px; line-height: 18px; font-size: 12px;">'
|
str += '<div style="white-space:nowrap;overflow-x:hidden;text-overflow:ellipsis;display: flex; justify-content: space-between; min-width: 150px; max-width: 600px; line-height: 18px; font-size: 12px;">'
|
||||||
@@ -1163,9 +1177,13 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
str += '</div>'
|
str += '</div>'
|
||||||
|
if (!showFlag) {
|
||||||
|
return ''
|
||||||
|
} else {
|
||||||
return str
|
return str
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
getChart(self.chartIndex) && getChart(self.chartIndex).setOption({
|
getChart(self.chartIndex) && getChart(self.chartIndex).setOption({
|
||||||
@@ -1295,6 +1313,7 @@ export default {
|
|||||||
formatter: function (params) {
|
formatter: function (params) {
|
||||||
let str = '<div>'
|
let str = '<div>'
|
||||||
let sum = 0
|
let sum = 0
|
||||||
|
let showFlag = false
|
||||||
let minusFlag = true
|
let minusFlag = true
|
||||||
params.forEach((item, i) => {
|
params.forEach((item, i) => {
|
||||||
const tip = self.legendMagicType[item.seriesIndex]
|
const tip = self.legendMagicType[item.seriesIndex]
|
||||||
@@ -1317,6 +1336,10 @@ export default {
|
|||||||
str += '</div>'
|
str += '</div>'
|
||||||
minusFlag = false
|
minusFlag = false
|
||||||
}
|
}
|
||||||
|
showFlag = showFlag || item.data[1]
|
||||||
|
if (isNaN(item.data[1] + '')) {
|
||||||
|
return
|
||||||
|
}
|
||||||
const previousItem = params.find((series) => ('Previous ' + item.seriesName) === series.seriesName)
|
const previousItem = params.find((series) => ('Previous ' + item.seriesName) === series.seriesName)
|
||||||
const val = formatScientificNotation(item.data[1], 2)
|
const val = formatScientificNotation(item.data[1], 2)
|
||||||
sum += isNaN(self.numberWithEConvent(val)) ? 0 : Number(self.numberWithEConvent(val))
|
sum += isNaN(self.numberWithEConvent(val)) ? 0 : Number(self.numberWithEConvent(val))
|
||||||
@@ -1373,9 +1396,13 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
str += '</div>'
|
str += '</div>'
|
||||||
|
if (!showFlag) {
|
||||||
|
return ''
|
||||||
|
} else {
|
||||||
return str
|
return str
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
this.setOption({
|
this.setOption({
|
||||||
|
|||||||
@@ -413,6 +413,7 @@ export default {
|
|||||||
return params.title
|
return params.title
|
||||||
},
|
},
|
||||||
defaultTooltipFormatter: function (params) {
|
defaultTooltipFormatter: function (params) {
|
||||||
|
let showFlag = false
|
||||||
let minusFlag = true
|
let minusFlag = true
|
||||||
let str = '<div>'
|
let str = '<div>'
|
||||||
params instanceof Array || (params = [params])
|
params instanceof Array || (params = [params])
|
||||||
@@ -436,6 +437,10 @@ export default {
|
|||||||
str += '<br/>'
|
str += '<br/>'
|
||||||
minusFlag = false
|
minusFlag = false
|
||||||
}
|
}
|
||||||
|
showFlag = showFlag || item.data[1]
|
||||||
|
if (isNaN(item.data[1] + '')) {
|
||||||
|
return
|
||||||
|
}
|
||||||
const val = Number(item.data[1])
|
const val = Number(item.data[1])
|
||||||
str += '<div style="white-space:nowrap;overflow-x:hidden;text-overflow:ellipsis;display: flex; justify-content: space-between; min-width: 150px; max-width: 600px; line-height: 18px; font-size: 12px;">'
|
str += '<div style="white-space:nowrap;overflow-x:hidden;text-overflow:ellipsis;display: flex; justify-content: space-between; min-width: 150px; max-width: 600px; line-height: 18px; font-size: 12px;">'
|
||||||
str += `<div style="max-width: 500px;white-space:nowrap;overflow-x:hidden;text-overflow:ellipsis;"><span style='display:inline-block;margin-right:5px;border-radius:10px;width:15px;height:5px;background-color: ${item.color};}'></span>${alias || item.seriesName}: </div>`
|
str += `<div style="max-width: 500px;white-space:nowrap;overflow-x:hidden;text-overflow:ellipsis;"><span style='display:inline-block;margin-right:5px;border-radius:10px;width:15px;height:5px;background-color: ${item.color};}'></span>${alias || item.seriesName}: </div>`
|
||||||
@@ -472,7 +477,11 @@ export default {
|
|||||||
str += '</div>'
|
str += '</div>'
|
||||||
})
|
})
|
||||||
str += '</div>'
|
str += '</div>'
|
||||||
|
if (!showFlag) {
|
||||||
|
return ''
|
||||||
|
} else {
|
||||||
return str
|
return str
|
||||||
|
}
|
||||||
},
|
},
|
||||||
queryAlias: function (i) {
|
queryAlias: function (i) {
|
||||||
let alias = null
|
let alias = null
|
||||||
|
|||||||
Reference in New Issue
Block a user