|
@@ -615,24 +615,27 @@ func GetChartThemeConfig(chartThemeId, source, chartType int) (chartTheme *chart
|
|
|
func ConvertOldChartOptions(config string) (newConfig string, err error) {
|
|
|
var oldTheme request.OldChartOptions
|
|
|
|
|
|
- var newTheme request.NewChartOptions
|
|
|
- err = json.Unmarshal([]byte(config), &oldTheme)
|
|
|
- if err != nil {
|
|
|
- return
|
|
|
- }
|
|
|
- newTheme.OldChartOptions = oldTheme
|
|
|
- for i := 0; i < 10; i++ {
|
|
|
- newLineOption := request.NewLineOptions{
|
|
|
- LineOptions: oldTheme.LineOptions,
|
|
|
- Color: oldTheme.ColorsOptions[i],
|
|
|
- DataMark: "none",
|
|
|
- MarkType: "square",
|
|
|
- MarkSize: 5,
|
|
|
- MarkColor: oldTheme.ColorsOptions[i],
|
|
|
- }
|
|
|
- newTheme.LineOptionList = append(newTheme.LineOptionList, newLineOption)
|
|
|
- }
|
|
|
- newThemeStr, _ := json.Marshal(newTheme)
|
|
|
- newConfig = string(newThemeStr)
|
|
|
+ var newTheme request.NewChartOptions
|
|
|
+ err = json.Unmarshal([]byte(config), &oldTheme)
|
|
|
+ if err != nil {
|
|
|
return
|
|
|
-}
|
|
|
+ }
|
|
|
+ if oldTheme.LineOptionList != nil && len(oldTheme.LineOptionList) > 0 {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ newTheme.OldChartOptions = oldTheme
|
|
|
+ for i := 0; i < 10; i++ {
|
|
|
+ newLineOption := request.NewLineOptions{
|
|
|
+ LineOptions: oldTheme.LineOptions,
|
|
|
+ Color: oldTheme.ColorsOptions[i],
|
|
|
+ DataMark: "none",
|
|
|
+ MarkType: "square",
|
|
|
+ MarkSize: 5,
|
|
|
+ MarkColor: oldTheme.ColorsOptions[i],
|
|
|
+ }
|
|
|
+ newTheme.LineOptionList = append(newTheme.LineOptionList, newLineOption)
|
|
|
+ }
|
|
|
+ newThemeStr, _ := json.Marshal(newTheme)
|
|
|
+ newConfig = string(newThemeStr)
|
|
|
+ return
|
|
|
+}
|