From 78d56bedf1aa09bdf7933e20e2de6624c130c1fb Mon Sep 17 00:00:00 2001 From: zhangyu Date: Tue, 16 Nov 2021 15:32:09 +0800 Subject: [PATCH] =?UTF-8?q?NEZ-1253=20fix:=20Chart=20Previous=20=E4=B9=8B?= =?UTF-8?q?=E5=89=8D=E4=B8=80=E5=B0=8F=E6=97=B6=E5=AF=B9=E6=AF=94=E6=95=B0?= =?UTF-8?q?=E5=80=BC=E6=9C=89=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/charts/line-chart-block.vue | 10 ++++++---- .../src/components/page/dashboard/overview/chart.vue | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/nezha-fronted/src/components/charts/line-chart-block.vue b/nezha-fronted/src/components/charts/line-chart-block.vue index c0bb07d05..46cff7ab0 100644 --- a/nezha-fronted/src/components/charts/line-chart-block.vue +++ b/nezha-fronted/src/components/charts/line-chart-block.vue @@ -790,13 +790,14 @@ export default { } const val = formatScientificNotation(item.data[1], paramsDot) sum += self.numberWithEConvent(val) + str += '
' str += `
${tip ? (tip.alias ? tip.alias : tip.name) : item.seriesName}
` str += '
' str += chartDataFormat.getUnit(chartInfo.unit ? chartInfo.unit : 2).compute(val, null, -1, paramsDot) if (previousItem) { - str += '' - const previousval = formatScientificNotation(item.data[1], paramsDot) + str += '' + const previousval = formatScientificNotation(previousItem.data[1], paramsDot) let minusVal = 0 if (previousval <= val) { minusVal = val - previousval @@ -1266,7 +1267,7 @@ export default { str += '
' str += chartDataFormat.getUnit(chartInfo.unit ? chartInfo.unit : 2).compute(val, null, self.chartDot) if (previousItem) { - str += '' + str += '' const previousval = formatScientificNotation(previousItem.data[1], 2) let minusVal = 0 if (previousval <= val) { @@ -1578,6 +1579,7 @@ export default { this.echartModalStore.showLoading(); } */ + let self = this let axiosArr = [] this.$nextTick(() => { let startTime = bus.timeFormate(this.searchTime[0], 'yyyy-MM-dd hh:mm:ss') @@ -1685,7 +1687,7 @@ export default { label: { distance: this.computeDistance(chartDataFormat.getUnit(this.data.unit ? this.data.unit : 2).compute(this.data.param.threshold)), formatter: function (params) { - return chartDataFormat.getUnit(this.data.unit ? this.data.unit : 2).compute(params.value) + return chartDataFormat.getUnit(self.data ? self.data.unit : 2).compute(params.value) } }, lineStyle: { diff --git a/nezha-fronted/src/components/page/dashboard/overview/chart.vue b/nezha-fronted/src/components/page/dashboard/overview/chart.vue index 6afe9776e..e8a55d15b 100644 --- a/nezha-fronted/src/components/page/dashboard/overview/chart.vue +++ b/nezha-fronted/src/components/page/dashboard/overview/chart.vue @@ -450,7 +450,7 @@ export default { str += chartDataFormat.getUnit(this.unit).compute(val, null, -1, dot) const previousItem = params.find((series) => ('Previous ' + item.seriesName) === series.seriesName) if (previousItem) { - str += '' + str += '' const previousval = formatScientificNotation(previousItem.data[1], dot) let minusVal = 0 if (previousval <= val) {