NEZ-1328 fix: line-chart 数值为null时不显示tooltip

This commit is contained in:
zhangyu
2021-11-27 11:42:27 +08:00
parent d15931a5bf
commit dc638be860
3 changed files with 65 additions and 20 deletions

View File

@@ -924,6 +924,7 @@ export default {
formatter: function (params) {
let str = '<div>'
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 += '<br/>'
}
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 += '<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,7 +965,11 @@ export default {
str += '</div>'
}
str += '</div>'
return str
if (!showFlag) {
return ''
} else {
return str
}
}
},
legend: {