diff --git a/nezha-fronted/src/components/charts/line-chart-block.vue b/nezha-fronted/src/components/charts/line-chart-block.vue index 53698648c..2115d834a 100644 --- a/nezha-fronted/src/components/charts/line-chart-block.vue +++ b/nezha-fronted/src/components/charts/line-chart-block.vue @@ -938,6 +938,7 @@ export default { window.addEventListener('resize', this.chartResize) getChart(this.chartIndex).on('magictypechanged', function (params) { self.isStackArea = !self.isStackArea + console.log(params,self.isStackArea); if (self.isStackArea) { getChart(self.chartIndex).setOption({ toolbox: { @@ -1138,16 +1139,25 @@ export default { formatter: function (params) { let str = '
' let sum = 0 + let minusFlag = true params.forEach((item, i) => { const tip = legend[item.seriesIndex] const color = self.bgColorList[item.seriesIndex] - if (i === 0) { + if (i === 0 && tip.alias.indexOf('Previous ') === -1) { const value = item.data[0] const tData = new Date(value) str += '
' str += bus.timeFormate(tData) str += '
' } + if (tip.alias.indexOf('Previous ') !== -1 && minusFlag) { + const value = item.data[0] - minusTime + const tData = new Date(value) + str += '
' + str += bus.timeFormate(tData) + str += '
' + minusFlag = false + } let val = parseFloat(Number(item.data[1]).toFixed(2)) if (val === 0) { val = Number(item.data[1]).toExponential(2) diff --git a/nezha-fronted/src/components/common/multipleTime.vue b/nezha-fronted/src/components/common/multipleTime.vue index aba996555..362816d6b 100644 --- a/nezha-fronted/src/components/common/multipleTime.vue +++ b/nezha-fronted/src/components/common/multipleTime.vue @@ -113,7 +113,8 @@