Browse Source

处理预测指标绘图无主题的样式

Karsa 10 months ago
parent
commit
e525ec9dad
1 changed files with 7 additions and 5 deletions
  1. 7 5
      src/views/dataEntry_manage/mixins/addOreditMixin.js

+ 7 - 5
src/views/dataEntry_manage/mixins/addOreditMixin.js

@@ -425,13 +425,15 @@ export default {
 		/* 添加指标时 配置默认颜色 线条等 */
 		setAddChartDefault() {
 
-			let themeOpt = JSON.parse(this.chartInfo.ChartThemeStyle);
+			let themeOpt = this.chartInfo.ChartThemeStyle ? JSON.parse(this.chartInfo.ChartThemeStyle) : null;
 
 			this.tableData.forEach((item,index) => {
-				item.ChartColor = item.ChartColor || themeOpt.colorsOptions[index];
-				item.PredictChartColor = item.PredictChartColor || themeOpt.colorsOptions[index];
-				item.ChartStyle = item.ChartStyle || (themeOpt.lineOptions.lineType||'spline');
-				this.tableData[index].ChartWidth = this.tableData[index].ChartWidth || themeOpt.lineOptions.lineWidth;
+				item.ChartColor = item.ChartColor || (themeOpt&&themeOpt.colorsOptions[index]||defaultOpts.colors[index]);
+				item.PredictChartColor = item.PredictChartColor || (themeOpt&&themeOpt.colorsOptions[index]||defaultOpts.colors[index]);
+				item.ChartStyle = item.ChartStyle || (themeOpt&&themeOpt.lineOptions.lineType||'spline');
+				
+				let configLineWid = index===0?3:1;//兼容预测指标绘图无主题配置
+				this.tableData[index].ChartWidth = this.tableData[index].ChartWidth || (themeOpt&&themeOpt.lineOptions.lineWidth||configLineWid);
 			})
 		},