From a828bb390598c3cb1501cbc221103a8901f9f9a8 Mon Sep 17 00:00:00 2001 From: zhangyu Date: Thu, 1 Apr 2021 14:05:35 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=E4=BF=AE=E6=94=B9=E5=85=A8?= =?UTF-8?q?=E5=B1=8F=E5=88=87=E6=8D=A2=E5=A0=86=E5=8F=A0=E5=90=8E=20toolti?= =?UTF-8?q?p=E6=98=BE=E7=A4=BA=E4=B8=8D=E6=AD=A3=E7=A1=AE=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/charts/line-chart-block.vue | 12 +++++++++++- nezha-fronted/src/components/common/multipleTime.vue | 3 ++- 2 files changed, 13 insertions(+), 2 deletions(-) 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 @@