From 87b49de83ff10b7e9548b77e38c4cab4b93bbf9c Mon Sep 17 00:00:00 2001 From: zhangyu Date: Thu, 18 Nov 2021 10:37:26 +0800 Subject: [PATCH] =?UTF-8?q?NEZ-1262=20fix=EF=BC=9A=20=E5=88=87=E6=8D=A2=20?= =?UTF-8?q?legend=E6=97=B6=20=E6=9C=AA=E5=88=87=E6=8D=A2Y=E8=BD=B4?= =?UTF-8?q?=E5=88=BB=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/charts/line-chart-block.vue | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/nezha-fronted/src/components/charts/line-chart-block.vue b/nezha-fronted/src/components/charts/line-chart-block.vue index 8424d1151..d084d7e68 100644 --- a/nezha-fronted/src/components/charts/line-chart-block.vue +++ b/nezha-fronted/src/components/charts/line-chart-block.vue @@ -428,6 +428,20 @@ export default { }) this.$set(this.isGrey, index, !this.isGrey[index]) } + const chartInfo = this.data + const dataArg = this.seriesItem.filter((seriesItem, seriesIndex) => !this.isGrey[seriesIndex]) + const maxValueCopies = this.getMaxValue(dataArg, chartInfo) + const maxValue = maxValueCopies.maxValue + // const minValue = maxValueCopies.minValue + // const dot = maxValueCopies.dot + const copies = maxValueCopies.copies + const unit = maxValueCopies.unit + getChart(this.chartIndex).setOption({ + yAxis: { + minInterval: chartDataFormat.Interval(maxValue, copies, unit.type, 'min'), + maxInterval: chartDataFormat.Interval(maxValue, copies, unit.type, 'max') * Math.ceil(dataArg.length / 5) + } + }) } }, clickLegend2 (legendName, index) { @@ -516,6 +530,20 @@ export default { }) this.$set(this.isGreyScreen, index, !this.isGreyScreen[index]) } + const chartInfo = this.data + const dataArg = this.seriesItemScreen.filter((seriesItem, seriesIndex) => !this.isGreyScreen[seriesIndex]) + const maxValueCopies = this.getMaxValue(dataArg, chartInfo) + const maxValue = maxValueCopies.maxValue + // const minValue = maxValueCopies.minValue + // const dot = maxValueCopies.dot + const copies = maxValueCopies.copies + const unit = maxValueCopies.unit + echart.setOption({ + yAxis: { + minInterval: chartDataFormat.Interval(maxValue, copies, unit.type, 'min'), + maxInterval: chartDataFormat.Interval(maxValue, copies, unit.type, 'max') * Math.ceil(dataArg.length / 5) + } + }) } }, clickScreenLegend2 (legendName, index) {