|
@@ -176,18 +176,21 @@ export default {
|
|
|
console.log("curEdit.option 不存在", this.curEdit);
|
|
|
}
|
|
|
},
|
|
|
+
|
|
|
changeChart() {
|
|
|
if (!this.curEdit || !this.curEdit.option) return; // 确保 curEdit 和 option 存在
|
|
|
const item = JSON.parse(JSON.stringify(this.curEdit));
|
|
|
-
|
|
|
// 确保 title, xAxis, yAxis 存在
|
|
|
item.option.title = item.option.title || {};
|
|
|
- item.option.xAxis = item.option.xAxis || {};
|
|
|
- item.option.yAxis = item.option.yAxis || {};
|
|
|
// 更新标题和坐标轴名称
|
|
|
Object.assign(item.option.title, { text: this.formLabelAlign.text });
|
|
|
- Object.assign(item.option.xAxis, { name: this.formLabelAlign.Xlable });
|
|
|
- Object.assign(item.option.yAxis, { name: this.formLabelAlign.Ylable });
|
|
|
+ if (this.curEdit.type !== "pie" && this.curEdit.type !== "radar") {
|
|
|
+ item.option.xAxis = item.option.xAxis || {};
|
|
|
+ item.option.yAxis = item.option.yAxis || {};
|
|
|
+ Object.assign(item.option.xAxis, { name: this.formLabelAlign.Xlable });
|
|
|
+ Object.assign(item.option.yAxis, { name: this.formLabelAlign.Ylable });
|
|
|
+ }
|
|
|
+
|
|
|
this.updateChart(item); // 更新图表
|
|
|
},
|
|
|
},
|