From 8013a8db9fdd272e746eaad1026cd3476fd37e37 Mon Sep 17 00:00:00 2001 From: zyh Date: Fri, 26 May 2023 10:49:16 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=E4=BF=AE=E5=A4=8D=E5=A4=8D?= =?UTF-8?q?=E5=88=B6=E5=9B=BE=E8=A1=A8=20=E6=97=A7=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E4=B8=AD=E4=B8=8D=E5=AD=98=E5=9C=A8=E7=9A=84=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/bottomBox/tabs/dashboardTab.vue | 22 +++++++++++++++---- .../components/page/dashboard/dashboard.vue | 22 +++++++++++++++---- 2 files changed, 36 insertions(+), 8 deletions(-) diff --git a/nezha-fronted/src/components/common/bottomBox/tabs/dashboardTab.vue b/nezha-fronted/src/components/common/bottomBox/tabs/dashboardTab.vue index 20e18bdff..e6ab96f42 100644 --- a/nezha-fronted/src/components/common/bottomBox/tabs/dashboardTab.vue +++ b/nezha-fronted/src/components/common/bottomBox/tabs/dashboardTab.vue @@ -435,6 +435,20 @@ export default { if (!this.chart.groupId || this.chart.groupId == -1) { this.chart.groupId = '' } + if ((this.chart.type === 'line' || this.chart.type === 'area' || this.chart.type === 'point') && !this.chart.param.rightYAxis) { + this.chart.param.rightYAxis = { + elementNames: [], + style: 'line', + unit: 2, + label: '', + min: undefined, + max: undefined + } + } + if (this.chart.type === 'stat') { + if (!this.chart.param.sparklineMode) { this.chart.param.sparklineMode = 'none' } + if (!this.chart.param.comparison) { this.chart.param.comparison = 'none' } + } } else { this.rightBox.loading = true this.$get('visual/dashboard/chart/' + data.id).then(res => { @@ -449,7 +463,10 @@ export default { } else { this.chart.param = {} } - if (!this.chart.param.rightYAxis) { + if (!this.chart.groupId || this.chart.groupId == -1) { + this.chart.groupId = '' + } + if ((this.chart.type === 'line' || this.chart.type === 'area' || this.chart.type === 'point') && !this.chart.param.rightYAxis) { this.chart.param.rightYAxis = { elementNames: [], style: 'line', @@ -459,9 +476,6 @@ export default { max: undefined } } - if (!this.chart.groupId || this.chart.groupId == -1) { - this.chart.groupId = '' - } if (this.chart.type === 'stat') { if (!this.chart.param.sparklineMode) { this.chart.param.sparklineMode = 'none' } if (!this.chart.param.comparison) { this.chart.param.comparison = 'none' } diff --git a/nezha-fronted/src/components/page/dashboard/dashboard.vue b/nezha-fronted/src/components/page/dashboard/dashboard.vue index 9d3a333e1..930b69a42 100644 --- a/nezha-fronted/src/components/page/dashboard/dashboard.vue +++ b/nezha-fronted/src/components/page/dashboard/dashboard.vue @@ -604,6 +604,20 @@ export default { if (!this.chart.groupId || this.chart.groupId == -1) { this.chart.groupId = '' } + if ((this.chart.type === 'line' || this.chart.type === 'area' || this.chart.type === 'point') && !this.chart.param.rightYAxis) { + this.chart.param.rightYAxis = { + elementNames: [], + style: 'line', + unit: 2, + label: '', + min: undefined, + max: undefined + } + } + if (this.chart.type === 'stat') { + if (!this.chart.param.sparklineMode) { this.chart.param.sparklineMode = 'none' } + if (!this.chart.param.comparison) { this.chart.param.comparison = 'none' } + } } else { this.rightBox.loading = true this.$get('visual/dashboard/chart/' + data.id).then(res => { @@ -618,7 +632,10 @@ export default { } else { this.chart.param = {} } - if (!this.chart.param.rightYAxis) { + if (!this.chart.groupId || this.chart.groupId == -1) { + this.chart.groupId = '' + } + if ((this.chart.type === 'line' || this.chart.type === 'area' || this.chart.type === 'point') && !this.chart.param.rightYAxis) { this.chart.param.rightYAxis = { elementNames: [], style: 'line', @@ -628,9 +645,6 @@ export default { max: undefined } } - if (!this.chart.groupId || this.chart.groupId == -1) { - this.chart.groupId = '' - } if (this.chart.type === 'stat') { if (!this.chart.param.sparklineMode) { this.chart.param.sparklineMode = 'none' } if (!this.chart.param.comparison) { this.chart.param.comparison = 'none' }