diff --git a/nezha-fronted/src/components/chart/panelChart.vue b/nezha-fronted/src/components/chart/panelChart.vue index 00d783cc0..9c8d5f904 100644 --- a/nezha-fronted/src/components/chart/panelChart.vue +++ b/nezha-fronted/src/components/chart/panelChart.vue @@ -161,6 +161,18 @@ export default { switch (this.chartInfo.datasource) { case 'metrics': case 'logs': { + if (this.from === fromRoute.chartTemp) { + setTimeout(() => { + this.chartData = [chartTempData.data.result] + this.chartData.forEach(item => { + item.forEach(children => { + children.elements = elements[0] + }) + }) + this.loading = false + }, 100) + return + } let urlPre = '' if (this.chartInfo.datasource === 'metrics') { urlPre += '/prom' @@ -210,6 +222,7 @@ export default { if (rIndex < elements.length) { if (r.status === 'success') { r.data.result.forEach(item => { + item.elements = elements[rIndex] this.allDataLength++ }) chartData.push(r.data.result) @@ -245,6 +258,13 @@ export default { } case 'system': { this.chartInfo.elements = this.chartInfo.param.datasource + if (this.from === fromRoute.chartTemp) { + setTimeout(() => { + this.chartData = [chartTempData.data.result] + this.loading = false + }, 100) + return + } if (this.chartInfo.type === 'assetInfo') { this.$get('asset/asset/' + this.chartDetailInfo.id).then(res => { this.chartData = res.data diff --git a/nezha-fronted/src/components/common/rightBox/chart/chartRightBox.vue b/nezha-fronted/src/components/common/rightBox/chart/chartRightBox.vue index b4861b05f..dfa796a9a 100644 --- a/nezha-fronted/src/components/common/rightBox/chart/chartRightBox.vue +++ b/nezha-fronted/src/components/common/rightBox/chart/chartRightBox.vue @@ -458,12 +458,20 @@ export default { valueMapping: false } } + // this.editChart.varType = 1 if (this.editChart.param.enable.legend && !this.editChart.param.legend) { this.editChart.param.legend = { placement: 'bottom', values: [], show: true } } if (this.editChart.param.datasource && !this.editChart.param.datasource[0].legend) { this.editChart.param.datasource[0].legend = '' } + if (this.editChart.param.valueMapping) { + this.editChart.param.valueMapping.forEach(item => { + if (!item.show) { + item.show = false + } + }) + } } } },