From 0e5c395b974b187b4227ed86dac746131425052a Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期日, 19 十一月 2023 12:21:18 +0800
Subject: [PATCH] 2023-11-19

---
 src/menu/components/chart/antv-bar/index.jsx |   31 +++++++++++++++++++++++++++----
 1 files changed, 27 insertions(+), 4 deletions(-)

diff --git a/src/menu/components/chart/antv-bar/index.jsx b/src/menu/components/chart/antv-bar/index.jsx
index ad556b3..7d21460 100644
--- a/src/menu/components/chart/antv-bar/index.jsx
+++ b/src/menu/components/chart/antv-bar/index.jsx
@@ -581,6 +581,29 @@
         fill: '#fff'
       }
     }
+    let label = plot.label
+
+    if (Bar_axis.length) {
+      if (label === 'false') {
+        plot.customs.forEach(item => {
+          if (!Bar_axis.includes(item.type)) return
+          if (item.label === 'true') {
+            label = 'true'
+          }
+        })
+      } else {
+        let reset = true
+        plot.customs.forEach(item => {
+          if (!Bar_axis.includes(item.type)) return
+          if (item.label === 'true') {
+            reset = false
+          }
+        })
+        if (reset) {
+          label = 'false'
+        }
+      }
+    }
 
     if (plot.label === 'top') {
       lablecfg.offset = -5
@@ -682,13 +705,13 @@
         } else {
           _chart.color('key')
         }
-        if (plot.label !== 'false') {
+        if (label !== 'false') {
           _chart.label('value*key', (value, key) => {
             if (plot.show === 'percent') {
               value = value + '%'
             }
 
-            if (plot.label === 'true' && plot.labelColor === 'custom' && colors.has(key)) {
+            if (label === 'true' && plot.labelColor === 'custom' && colors.has(key)) {
               lablecfg.style.fill = colors.get(key)
             }
             return {
@@ -733,13 +756,13 @@
         } else {
           _chart.color('key')
         }
-        if (plot.label !== 'false') {
+        if (label !== 'false') {
           _chart.label('value*key', (value, key) => {
             if (plot.show === 'percent') {
               value = value + '%'
             }
 
-            if (plot.label === 'true' && plot.labelColor === 'custom' && colors.has(key)) {
+            if (label === 'true' && plot.labelColor === 'custom' && colors.has(key)) {
               lablecfg.style.fill = colors.get(key)
             }
 

--
Gitblit v1.8.0