diff options
| author | zhangyu <[email protected]> | 2021-04-01 15:18:49 +0800 |
|---|---|---|
| committer | zhangyu <[email protected]> | 2021-04-01 15:18:49 +0800 |
| commit | 7648b3868dff43297143adf88e00a930b879cb0f (patch) | |
| tree | 5bb9455d83e64c9da42f8b42d197c983ac79a30f | |
| parent | a828bb390598c3cb1501cbc221103a8901f9f9a8 (diff) | |
fix:修改因为堆叠按钮导致的时间显示错误的问题
| -rw-r--r-- | nezha-fronted/src/components/charts/line-chart-block.vue | 11 |
1 files 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 += '</div>' } 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 += '<div style="margin-bottom: 5px;margin-top: 5px">' str += bus.timeFormate(tData) @@ -973,7 +975,7 @@ export default { let str = '<div>' 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 = '<div>' 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 += '</div>' } 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 += '<div style="margin-bottom: 5px;margin-top: 5px">' str += bus.timeFormate(tData) |
