From 335ede10b70470e5dc45e2ebea307c278bac430d Mon Sep 17 00:00:00 2001 From: zhangyu Date: Wed, 28 Jul 2021 17:05:03 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=20=E5=9B=BE=E8=A1=A8=E7=9A=84?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E8=BD=B4=E5=88=BB=E5=BA=A6=E8=B7=9F=E5=9B=BE?= =?UTF-8?q?=E8=A1=A8=E5=AE=BD=E5=BA=A6=E5=85=B3=E8=81=94=EF=BC=88=E5=B0=8F?= =?UTF-8?q?=E4=BA=8E500=E6=97=B6=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/charts/chart-list.vue | 6 +++++- .../src/components/charts/line-chart-block.vue | 16 +++++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/nezha-fronted/src/components/charts/chart-list.vue b/nezha-fronted/src/components/charts/chart-list.vue index 440eb8108..d7951dc4a 100644 --- a/nezha-fronted/src/components/charts/chart-list.vue +++ b/nezha-fronted/src/components/charts/chart-list.vue @@ -1757,7 +1757,11 @@ export default { resize () { this.init() this.$nextTick(() => { - this.$parent.$parent.dateChange() + if (this.$parent.$parent.dateChange) { + this.$parent.$parent.dateChange() + } else { + this.$parent.dateChange() + } }) }, init () { diff --git a/nezha-fronted/src/components/charts/line-chart-block.vue b/nezha-fronted/src/components/charts/line-chart-block.vue index 8683e5727..c65df0484 100644 --- a/nezha-fronted/src/components/charts/line-chart-block.vue +++ b/nezha-fronted/src/components/charts/line-chart-block.vue @@ -939,7 +939,6 @@ export default { dot = 1 } dot = bus.countDecimals(value) - // console.log(dot,val) if (dot < self.chartDot) { dot = self.chartDot } @@ -972,6 +971,14 @@ export default { } else { option.xAxis.minInterval = 20 * 60 * 1000 } + } else { + if (this.$refs.resizeBox.offsetWidth < 200) { + option.xAxis.splitNumber = 1 + } else if (this.$refs.resizeBox.offsetWidth < 300) { + option.xAxis.splitNumber = 3 + } else if (this.$refs.resizeBox.offsetWidth < 500) { + option.xAxis.splitNumber = 5 + } } // params.series = dataArg; if (chartSite === 'local') { // 本地显示 @@ -1009,6 +1016,13 @@ export default { } else { self.noData = true option = chartConfig.getOptionNoData('noData') + if (self.$refs.resizeBox.offsetWidth < 200) { + option.xAxis.splitNumber = 1 + } else if (self.$refs.resizeBox.offsetWidth < 300) { + option.xAxis.splitNumber = 3 + } else if (self.$refs.resizeBox.offsetWidth < 500) { + option.xAxis.splitNumber = 5 + } getChart(self.chartIndex).clear() getChart(self.chartIndex).setOption(option)// 创建图表 }