From 9e60fb89a8b1c8a1d16b557b20b6d0a509f37983 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 04 六月 2021 19:22:39 +0800
Subject: [PATCH] 2021-06-04

---
 src/tabviews/custom/components/chart/antv-bar-line/index.jsx |   26 +++++++++++++-------------
 1 files changed, 13 insertions(+), 13 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 b1f524a..8ef127b 100644
--- a/src/tabviews/custom/components/chart/antv-bar-line/index.jsx
+++ b/src/tabviews/custom/components/chart/antv-bar-line/index.jsx
@@ -137,7 +137,7 @@
         item.chartType = item.shape ? (item.shape[0] || 'bar') : 'bar'
         item.shape = item.shape ? (item.shape[1] || '') : ''
   
-        if (colors.get(item.type)) {
+        if (colors.has(item.type)) {
           item.color = colors.get(item.type)
         } else {
           item.color = chartColors[colorIndex % limit]
@@ -841,11 +841,11 @@
     if (plot.colors && plot.colors.length > 0) {
       let limit = chartColors.length
       _chart.color(_typefield, (key) => {
-        if (colors.get(key)) {
+        if (colors.has(key)) {
           return colors.get(key)
         } else {
-          colors.set(key, chartColors[colorIndex % limit])
           colorIndex++
+          return chartColors[(colorIndex - 1) % limit]
         }
       })
     } else {
@@ -871,11 +871,11 @@
         .point()
         .position(`${plot.Xaxis}*${_valfield}`)
         .color(_typefield, (key) => {
-          if (colors.get(key)) {
+          if (colors.has(key)) {
             return colors.get(key)
           } else {
-            colors.set(key, chartColors[colorIndex % limit])
             colorIndex++
+            return chartColors[(colorIndex - 1) % limit]
           }
         })
         .size(3)
@@ -1052,11 +1052,11 @@
         if (plot.colors && plot.colors.length > 0) {
           let limit = chartColors.length
           _chart.color('key', (key) => {
-            if (colors.get(key)) {
+            if (colors.has(key)) {
               return colors.get(key)
             } else {
-              colors.set(key, chartColors[colorIndex % limit])
               colorIndex++
+              return chartColors[(colorIndex - 1) % limit]
             }
           })
         } else {
@@ -1101,11 +1101,11 @@
         if (plot.colors && plot.colors.length > 0) {
           let limit = chartColors.length
           _chart.color('key', (key) => {
-            if (colors.get(key)) {
+            if (colors.has(key)) {
               return colors.get(key)
             } else {
-              colors.set(key, chartColors[colorIndex % limit])
               colorIndex++
+              return chartColors[(colorIndex - 1) % limit]
             }
           })
         } else {
@@ -1392,11 +1392,11 @@
       if (plot.colors && plot.colors.length > 0) {
         let limit = chartColors.length
         _chart.color(_typefield, (key) => {
-          if (colors.get(key)) {
+          if (colors.has(key)) {
             return colors.get(key)
           } else {
-            colors.set(key, chartColors[colorIndex % limit])
             colorIndex++
+            return chartColors[(colorIndex - 1) % limit]
           }
         })
       } else {
@@ -1439,11 +1439,11 @@
       if (plot.colors && plot.colors.length > 0) {
         let limit = chartColors.length
         _chart.color(_typefield, (key) => {
-          if (colors.get(key)) {
+          if (colors.has(key)) {
             return colors.get(key)
           } else {
-            colors.set(key, chartColors[colorIndex % limit])
             colorIndex++
+            return chartColors[(colorIndex - 1) % limit]
           }
         })
       } else {

--
Gitblit v1.8.0