From 1f6d49bf15e6b50eeee1edc32022eb006b401835 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 08 二月 2023 00:35:55 +0800
Subject: [PATCH] 2023-02-08

---
 src/tabviews/custom/components/chart/antv-bar-line/index.jsx |   65 ++++++++++++++++++++++----------
 1 files changed, 45 insertions(+), 20 deletions(-)

diff --git a/src/tabviews/custom/components/chart/antv-bar-line/index.jsx b/src/tabviews/custom/components/chart/antv-bar-line/index.jsx
index 70caf6f..dc80392 100644
--- a/src/tabviews/custom/components/chart/antv-bar-line/index.jsx
+++ b/src/tabviews/custom/components/chart/antv-bar-line/index.jsx
@@ -1499,6 +1499,8 @@
             barcolors[item[plot.Xaxis]] = plot.barcolors[i].color
           }
         })
+      } else {
+        barcolors = null
       }
 
       const ds = new DataSet()
@@ -1633,16 +1635,28 @@
 
       if (plot.$colors) {
         let limit = chartColors.length
-        _chart.color(`${_typefield}*${plot.Xaxis}`, (key, label) => {
-          if (barcolors[label]) {
-            return barcolors[label]
-          } else if (plot.$colors.has(key)) {
-            return plot.$colors.get(key)
-          } else {
-            colorIndex++
-            return chartColors[(colorIndex - 1) % limit]
-          }
-        })
+
+        if (barcolors) {
+          _chart.color(`${_typefield}*${plot.Xaxis}`, (key, label) => {
+            if (barcolors[label]) {
+              return barcolors[label]
+            } else if (plot.$colors.has(key)) {
+              return plot.$colors.get(key)
+            } else {
+              colorIndex++
+              return chartColors[(colorIndex - 1) % limit]
+            }
+          })
+        } else {
+          _chart.color(`${_typefield}`, (key) => {
+            if (plot.$colors.has(key)) {
+              return plot.$colors.get(key)
+            } else {
+              colorIndex++
+              return chartColors[(colorIndex - 1) % limit]
+            }
+          })
+        }
       } else {
         _chart.color(_typefield)
       }
@@ -1697,16 +1711,27 @@
 
       if (plot.$colors) {
         let limit = chartColors.length
-        _chart.color(`${_typefield}*${plot.Xaxis}`, (key, label) => {
-          if (barcolors[label]) {
-            return barcolors[label]
-          } else if (plot.$colors.has(key)) {
-            return plot.$colors.get(key)
-          } else {
-            colorIndex++
-            return chartColors[(colorIndex - 1) % limit]
-          }
-        })
+        if (barcolors) {
+          _chart.color(`${_typefield}*${plot.Xaxis}`, (key, label) => {
+            if (barcolors[label]) {
+              return barcolors[label]
+            } else if (plot.$colors.has(key)) {
+              return plot.$colors.get(key)
+            } else {
+              colorIndex++
+              return chartColors[(colorIndex - 1) % limit]
+            }
+          })
+        } else {
+          _chart.color(`${_typefield}`, (key) => {
+            if (plot.$colors.has(key)) {
+              return plot.$colors.get(key)
+            } else {
+              colorIndex++
+              return chartColors[(colorIndex - 1) % limit]
+            }
+          })
+        }
       } else {
         _chart.color(_typefield)
       }

--
Gitblit v1.8.0