From cc810edac6aec3c858fb352091ad8c11332447a5 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期日, 10 十二月 2023 19:12:53 +0800
Subject: [PATCH] Merge branch 'develop'

---
 src/menu/components/chart/antv-bar/index.jsx |   70 +++++++++++++++++++++++++++++-----
 1 files changed, 59 insertions(+), 11 deletions(-)

diff --git a/src/menu/components/chart/antv-bar/index.jsx b/src/menu/components/chart/antv-bar/index.jsx
index ad556b3..8074b88 100644
--- a/src/menu/components/chart/antv-bar/index.jsx
+++ b/src/menu/components/chart/antv-bar/index.jsx
@@ -87,8 +87,14 @@
 
       this.updateComponent(_card, true)
     } else {
+      let _card = fromJS(card).toJS()
+      if (_card.plot.correction) {
+        delete _card.plot.correction // 鏁版嵁淇锛堝凡寮冪敤锛�
+        _card.plot.barSize = 35
+      }
+
       this.setState({
-        card: fromJS(card).toJS()
+        card: _card
       })
     }
   }
@@ -581,6 +587,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
@@ -605,6 +634,10 @@
       })
       const dst = new DataSet()
       const dvt = dst.createView().source(data)
+
+      // if (plot.mutilBar === 'stack') {
+      //   Bar_axis.reverse()
+      // }
   
       dvt.transform({
         type: 'fold',
@@ -682,13 +715,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 {
@@ -698,7 +731,7 @@
           })
         }
 
-        if (plot.barSize || plot.correction) {
+        if (plot.barSize) {
           _chart.size(plot.barSize || 35)
         }
         if (plot.barRadius) {
@@ -733,13 +766,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)
             }
 
@@ -750,7 +783,7 @@
           })
         }
 
-        if (plot.barSize || plot.correction) {
+        if (plot.barSize) {
           _chart.size(plot.barSize || 35)
         }
         if (plot.barRadius) {
@@ -773,7 +806,7 @@
 
     view2.data(dv.rows)
 
-    if (!noLegend) {
+    if (!noLegend && Bar_axis.length) {
       view2.legend(false)
     }
 
@@ -1098,7 +1131,7 @@
           })
         }
 
-        if (plot.barSize || plot.correction) {
+        if (plot.barSize) {
           _chart.size(plot.barSize || 35)
         }
         if (plot.selectColor) {
@@ -1158,7 +1191,7 @@
           })
         }
 
-        if (plot.barSize || plot.correction) {
+        if (plot.barSize) {
           _chart.size(plot.barSize || 35)
         }
         if (plot.selectColor) {
@@ -1312,6 +1345,21 @@
     this.updateComponent(_card)
   }
 
+  plotchange = (card) => {
+    if (card.plot.enabled === 'true' && card.plot.zoomYaxis !== 'custom' && card.plot.customs) {
+      card.plot.customs.forEach(item => {
+        item.min = ''
+        item.max = ''
+      })
+    }
+
+    if (card.plot.barcolors && (card.plot.enabled === 'true' || card.plot.datatype === 'statistics')) {
+      card.plot.barcolors = null
+    }
+
+    this.updateComponent(card)
+  }
+
   clickComponent = (e) => {
     if (sessionStorage.getItem('style-control') === 'true' || sessionStorage.getItem('style-control') === 'component') {
       e.stopPropagation()
@@ -1336,7 +1384,7 @@
           <div className="mk-popover-control">
             {appType !== 'mob' ? <PlusCircleOutlined className="plus" title="娣诲姞鎼滅储" onClick={this.addSearch}/> : null}
             {appType !== 'mob' ? <PlusSquareOutlined className="plus" title="娣诲姞鎸夐挳" onClick={this.addButton}/> : null}
-            <ChartCompileForm config={card} plotchange={this.updateComponent}/>
+            <ChartCompileForm config={card} plotchange={this.plotchange}/>
             <CopyComponent type="line" card={card}/>
             <PasteComponent config={card} options={['action', 'search']} updateConfig={this.updateComponent} />
             <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle}/>

--
Gitblit v1.8.0