From 0f6153ab337c4ecca5579a79b03f3ba5f831e0c4 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期日, 18 九月 2022 02:03:48 +0800
Subject: [PATCH] 2022-09-18

---
 src/menu/components/chart/antv-bar/chartcompile/index.jsx |   37 +++++++++++++++++++++++++++++--------
 1 files changed, 29 insertions(+), 8 deletions(-)

diff --git a/src/menu/components/chart/antv-bar/chartcompile/index.jsx b/src/menu/components/chart/antv-bar/chartcompile/index.jsx
index b49ad23..70b73e8 100644
--- a/src/menu/components/chart/antv-bar/chartcompile/index.jsx
+++ b/src/menu/components/chart/antv-bar/chartcompile/index.jsx
@@ -262,20 +262,41 @@
       }
     })
 
-    if (config.plot.correction) {
-      delete config.plot.correction // 鏁版嵁淇锛堝凡寮冪敤锛�
-      config.plot.barSize = 35
+    let plot = fromJS(config.plot).toJS()
+
+    if (plot.correction) {
+      delete plot.correction // 鏁版嵁淇锛堝凡寮冪敤锛�
+      plot.barSize = 35
+    }
+
+    if (plot.datatype !== 'statistics') {
+      if (plot.colors) {
+        plot.colors = plot.colors.map(item => {
+          if (fieldName[item.type]) {
+            item.label = fieldName[item.type]
+          }
+          return item
+        })
+      }
+      if (plot.customs) {
+        plot.customs = plot.customs.map(item => {
+          if (fieldName[item.type]) {
+            item.name = fieldName[item.type]
+          }
+          return item
+        })
+      }
     }
 
     this.setState({
       visible: true,
       view: 'normal',
-      ramp: config.plot.ramp || 'false',
-      datatype: config.plot.datatype || 'query',
+      ramp: plot.ramp || 'false',
+      datatype: plot.datatype || 'query',
       fieldName: fieldName,
-      plot: fromJS(config.plot).toJS(),
-      baseFormlist: getBaseForm(config.plot, config.columns),
-      formlist: getOptionForm(config.plot, config.columns)
+      plot: plot,
+      baseFormlist: getBaseForm(plot, config.columns),
+      formlist: getOptionForm(plot, config.columns)
     })
   }
 

--
Gitblit v1.8.0