diff --git a/nezha-fronted/src/components/charts/line-chart-block.vue b/nezha-fronted/src/components/charts/line-chart-block.vue index b3cd4dcee..27a070465 100644 --- a/nezha-fronted/src/components/charts/line-chart-block.vue +++ b/nezha-fronted/src/components/charts/line-chart-block.vue @@ -760,9 +760,8 @@ export default { str += `
${tip ? (tip.alias ? tip.alias : tip.name) : item.seriesName}
` str += '
' str += chartDataFormat.getUnit(chartInfo.unit ? chartInfo.unit : 2).compute(val, null, -1, oldDot) - str += '
' if (previousItem) { - str += '
' + str += '' let previousval = parseFloat(Number(previousItem.data[1]).toFixed(2)) if (previousval === 0) { previousval = Number(item.data[1]).toExponential(2) @@ -777,9 +776,13 @@ export default { } str += chartDataFormat.getUnit(chartInfo.unit ? chartInfo.unit : 2).compute(minusVal, null, 2) - str += '
' + str += '' + } else if (tip.alias.indexOf('Previous ') !== -1) { + str += '' + str += '' } str += '' + str += '' }) if (self.data.type === 'stackArea' || self.isStackArea) { if (!self.stackTotalColor || self.stackTotalColor == '') { @@ -1195,6 +1198,27 @@ export default { str += `
${tip ? (tip.alias ? tip.alias : tip.name) : item.seriesName}
` str += '
' str += chartDataFormat.getUnit(chartInfo.unit ? chartInfo.unit : 2).compute(val, null, 2) + if (previousItem) { + str += '' + let previousval = parseFloat(Number(previousItem.data[1]).toFixed(2)) + if (previousval === 0) { + previousval = Number(item.data[1]).toExponential(2) + } + let minusVal = 0 + if (previousval <= val) { + minusVal = val - previousval + str += '+' + } else { + minusVal = previousval - val + str += '-' + } + + str += chartDataFormat.getUnit(chartInfo.unit ? chartInfo.unit : 2).compute(minusVal, null, 2) + str += '' + } else if (tip.alias.indexOf('Previous ') !== -1) { + str += '' + str += '' + } str += '
' if (previousItem) { str += '
' diff --git a/nezha-fronted/src/components/page/dashboard/overview/chart.vue b/nezha-fronted/src/components/page/dashboard/overview/chart.vue index fe99cbd55..a10c833c4 100644 --- a/nezha-fronted/src/components/page/dashboard/overview/chart.vue +++ b/nezha-fronted/src/components/page/dashboard/overview/chart.vue @@ -17,289 +17,289 @@