zwxi 9 months ago
parent
commit
12d488e0c9
1 changed files with 18 additions and 0 deletions
  1. 18 0
      controllers/data_manage/chart_theme.go

+ 18 - 0
controllers/data_manage/chart_theme.go

@@ -52,6 +52,24 @@ func (c *ChartThemeController) List() {
 		br.ErrMsg = "获取图表样式类型信息失败,Err:" + err.Error()
 		return
 	}
+	var oldTheme request.OldChartOptions
+	for i, v := range list {
+		var newTheme request.NewChartOptions
+		err = json.Unmarshal([]byte(v.Config), &oldTheme)
+		if err != nil {
+			continue
+		}
+		newTheme.OldChartOptions = oldTheme
+		for i := 0; i < 10; i++ {
+			newLineOption := request.NewLineOptions{
+				LineOptions: oldTheme.LineOptions,
+				Color:       oldTheme.ColorsOptions[i],
+			}
+			newTheme.LineOptionList = append(newTheme.LineOptionList, newLineOption)
+		}
+		newThemeStr, _ := json.Marshal(newTheme)
+		list[i].Config = string(newThemeStr)
+	}
 
 	br.Ret = 200
 	br.Success = true