diff --git a/frontend/src/views/chart/components/ChartComponent.vue b/frontend/src/views/chart/components/ChartComponent.vue index 3cf27335bc..2e065d2594 100644 --- a/frontend/src/views/chart/components/ChartComponent.vue +++ b/frontend/src/views/chart/components/ChartComponent.vue @@ -52,8 +52,9 @@ export default { // console.log(chart_option); // 处理shape attr if (chart.customAttr) { - if (chart.customAttr.color) { - chart_option.color = chart.customAttr.color.colors + const customAttr = JSON.parse(chart.customAttr) + if (customAttr.color) { + chart_option.color = customAttr.color.colors } } this.myEcharts(chart_option) diff --git a/frontend/src/views/chart/components/ColorSelector.vue b/frontend/src/views/chart/components/ColorSelector.vue index 383cd1ee4f..088e271427 100644 --- a/frontend/src/views/chart/components/ColorSelector.vue +++ b/frontend/src/views/chart/components/ColorSelector.vue @@ -94,7 +94,12 @@ export default { 'chart': { handler: function() { const chart = JSON.parse(JSON.stringify(this.chart)) - this.colorForm.colorCase = chart.customAttr.color.value + if (chart.customAttr) { + const customAttr = JSON.parse(chart.customAttr) + if (customAttr.color) { + this.colorForm.colorCase = customAttr.color.value + } + } } } }, diff --git a/frontend/src/views/chart/view/ChartEdit.vue b/frontend/src/views/chart/view/ChartEdit.vue index b65d2cdb7a..00dc35945f 100644 --- a/frontend/src/views/chart/view/ChartEdit.vue +++ b/frontend/src/views/chart/view/ChartEdit.vue @@ -264,7 +264,7 @@ export default { getData(id) { if (id) { post('/chart/view/getData/' + id, null).then(response => { - this.view = response.data + this.view = JSON.parse(JSON.stringify(response.data)) this.view.xaxis = this.view.xaxis ? JSON.parse(this.view.xaxis) : [] this.view.yaxis = this.view.yaxis ? JSON.parse(this.view.yaxis) : [] this.view.customAttr = this.view.customAttr ? JSON.parse(this.view.customAttr) : {}