From 7648b3868dff43297143adf88e00a930b879cb0f Mon Sep 17 00:00:00 2001 From: zhangyu Date: Thu, 1 Apr 2021 15:18:49 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=E4=BF=AE=E6=94=B9=E5=9B=A0?= =?UTF-8?q?=E4=B8=BA=E5=A0=86=E5=8F=A0=E6=8C=89=E9=92=AE=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E7=9A=84=E6=97=B6=E9=97=B4=E6=98=BE=E7=A4=BA=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E7=9A=84=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 | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/nezha-fronted/src/components/charts/line-chart-block.vue b/nezha-fronted/src/components/charts/line-chart-block.vue index 2115d834a..2be4a507b 100644 --- a/nezha-fronted/src/components/charts/line-chart-block.vue +++ b/nezha-fronted/src/components/charts/line-chart-block.vue @@ -559,6 +559,7 @@ export default { }, // chartSite用于区分是全屏显示还是局部显示 initChart (chartInfo, dataArg, ele, chartSite, legend) { + this.legendMagicType = legend this.chartInfo = chartInfo const self = this this.chartType = '' // 图表类型 @@ -566,6 +567,7 @@ export default { this.chartType = 'line' } const minusTime = (new Date(this.searchTime[0]).getTime() - new Date(this.$refs.pickTime.$refs.multipleTime.searchTime[0]).getTime()) + this.minusTime = minusTime let minTime = null let maxTime = null if (dataArg.length > 0 && dataArg[0].data && @@ -738,7 +740,7 @@ export default { str += '' } if (tip.alias.indexOf('Previous ') !== -1 && minusFlag) { - const value = item.data[0] - minusTime + const value = item.data[0] - self.minusTime const tData = new Date(value) str += '
' str += bus.timeFormate(tData) @@ -973,7 +975,7 @@ export default { let str = '
' let sum = 0 params.forEach((item, i) => { - const tip = legend[item.seriesIndex] + const tip = self.legendMagicType[item.seriesIndex] const color = self.bgColorList[item.seriesIndex] if (i === 0) { const value = item.data[0] @@ -1140,8 +1142,9 @@ export default { let str = '
' let sum = 0 let minusFlag = true + // console.log(params ,legend); params.forEach((item, i) => { - const tip = legend[item.seriesIndex] + const tip = self.legendMagicType[item.seriesIndex] const color = self.bgColorList[item.seriesIndex] if (i === 0 && tip.alias.indexOf('Previous ') === -1) { const value = item.data[0] @@ -1151,7 +1154,7 @@ export default { str += '
' } if (tip.alias.indexOf('Previous ') !== -1 && minusFlag) { - const value = item.data[0] - minusTime + const value = item.data[0] - self.minusTime const tData = new Date(value) str += '
' str += bus.timeFormate(tData)