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' }