From 598d1cf91acd6d0c2782ae896b6eb78044eaf3e6 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 30 十二月 2021 21:10:14 +0800
Subject: [PATCH] 2021-12-30

---
 src/menu/components/chart/antv-bar/chartcompile/index.jsx      |   18 +++++++++++++++++-
 src/menu/components/chart/antv-bar/index.jsx                   |    9 +++++----
 src/menu/components/chart/antv-bar/chartcompile/formconfig.jsx |    4 ++--
 src/tabviews/custom/components/chart/antv-bar-line/index.jsx   |   24 +++++++++++++++++-------
 4 files changed, 41 insertions(+), 14 deletions(-)

diff --git a/src/menu/components/chart/antv-bar/chartcompile/formconfig.jsx b/src/menu/components/chart/antv-bar/chartcompile/formconfig.jsx
index 56f54d3..05158b6 100644
--- a/src/menu/components/chart/antv-bar/chartcompile/formconfig.jsx
+++ b/src/menu/components/chart/antv-bar/chartcompile/formconfig.jsx
@@ -274,12 +274,12 @@
     }, {
       type: 'radio',
       key: 'show',
-      label: '鏍煎紡鍖�',
+      label: '鏄剧ず',
       initVal: card.show || 'value',
       required: false,
       options: [{
         value: 'value',
-        text: '鏃�'
+        text: '鏁板��'
       }, {
         value: 'percent',
         text: '鐧惧垎姣�'
diff --git a/src/menu/components/chart/antv-bar/chartcompile/index.jsx b/src/menu/components/chart/antv-bar/chartcompile/index.jsx
index 16590f3..942c0cf 100644
--- a/src/menu/components/chart/antv-bar/chartcompile/index.jsx
+++ b/src/menu/components/chart/antv-bar/chartcompile/index.jsx
@@ -218,6 +218,22 @@
         }
       },
       {
+        title: '鏄剧ず',
+        dataIndex: 'show',
+        inputType: 'select',
+        editable: true,
+        required: false,
+        width: '12%',
+        options: [
+          { value: 'value', text: '鏁板��'},
+          { value: 'percent', text: '鐧惧垎姣�'}
+        ],
+        render: (text, record) => {
+          let trans = {'value': '鏁板��', 'percent': '鐧惧垎姣�'}
+          return trans[text] || ''
+        }
+      },
+      {
         title: '鏈�灏忓��',
         dataIndex: 'min',
         inputType: 'number',
@@ -687,7 +703,7 @@
                 </Form>
               </Col>
               <Col style={{fontSize: '12px', color: '#757575', paddingLeft: '10px'}} span={24}>娉細浣跨敤鑷畾涔夎缃椂锛屾樉绀虹殑鍧愭爣杞寸涓�涓湪宸︿晶锛岀浜屼釜鍦ㄥ彸渚э紝澶氫綑鐨勪笉鐢熸晥銆�</Col>
-              <EditTable actions={['edit', 'move']} data={plot.customs || []} columns={cusColumns} onChange={this.changeCustom}/>
+              <EditTable indexShow={false} actions={['edit', 'move']} data={plot.customs || []} columns={cusColumns} onChange={this.changeCustom}/>
             </TabPane> : null}
           </Tabs>
         </Modal>
diff --git a/src/menu/components/chart/antv-bar/index.jsx b/src/menu/components/chart/antv-bar/index.jsx
index 57ab6f4..56af912 100644
--- a/src/menu/components/chart/antv-bar/index.jsx
+++ b/src/menu/components/chart/antv-bar/index.jsx
@@ -476,6 +476,7 @@
       item.name = transfield[item.type] || item.type
       item.chartType = item.shape ? (item.shape[0] || 'bar') : 'bar'
       item.shape = item.shape ? (item.shape[1] || '') : ''
+      item.show = item.show || plot.show
 
       if (colors.has(item.name)) {
         item.color = colors.get(item.name)
@@ -815,7 +816,7 @@
           .color(item.color)
           .shape(item.shape)
           .tooltip(`${item.name}`, (value) => {
-            if (plot.show === 'percent') {
+            if (item.show === 'percent') {
               value = value + '%'
             }
             return {
@@ -829,7 +830,7 @@
         }
         if (item.label !== 'false') {
           _chart.label(item.name, (value) => {
-            if (plot.show === 'percent') {
+            if (item.show === 'percent') {
               value = value + '%'
             }
 
@@ -861,7 +862,7 @@
           .color(item.color)
           .shape(item.shape)
           .tooltip(`${item.name}`, (value) => {
-            if (plot.show === 'percent') {
+            if (item.show === 'percent') {
               value = value + '%'
             }
             return {
@@ -872,7 +873,7 @@
 
         if (item.label !== 'false') {
           _chart.label(item.name, (value) => {
-            if (plot.show === 'percent') {
+            if (item.show === 'percent') {
               value = value + '%'
             }
             let _color = color
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 1395851..8792192 100644
--- a/src/tabviews/custom/components/chart/antv-bar-line/index.jsx
+++ b/src/tabviews/custom/components/chart/antv-bar-line/index.jsx
@@ -126,7 +126,7 @@
 
       _config.plot.hasBar = Bar_axis.length > 0
 
-      if (_config.plot.mutilBar !== 'overlap') {
+      if (_config.plot.mutilBar !== 'overlap' && Bar_axis.length > 1) {
         _config.plot.Bar_axis = Bar_axis
       }
     } else {
@@ -237,7 +237,8 @@
       let axisIndex = 0
       let fields = []
       let legends = []
-  
+      let vFieldsShow = {}
+
       _config.plot.customs.forEach(item => {
         if (colors.has(item.name)) {
           item.color = colors.get(item.name)
@@ -294,10 +295,19 @@
           name: item.name,
           marker: { symbol: item.chartType === 'bar' ? 'square' : 'hyphen', style: { stroke: item.color,fill: item.color, r: 5, lineWidth: 2 } }
         })
+
+        if ((!_config.plot.Bar_axis || item.chartType !== 'bar') && item.show) { // 鎶樼嚎鍥炬垨閲嶅彔涓嬬殑鏌辩姸鍥惧彲鍗曠嫭璁剧疆鏄剧ず绫诲瀷
+          vFieldsShow[item.type] = item.show
+        }
       })
       _config.plot.customs = fields
       _config.plot.legends = legends
       _config.plot.axisIndex = axisIndex
+      vFields.forEach(item => {
+        if (vFieldsShow[item.field]) {
+          item.show = vFieldsShow[item.field]
+        }
+      })
     }
 
     this.setState({
@@ -1308,7 +1318,7 @@
     view2.data(dv.rows)
     view2.legend(false)
 
-    plot.customs.forEach((item, i) => {
+    plot.customs.forEach(item => {
       if (item.chartType === 'bar' && !plot.Bar_axis) {
         view2.axis(item.name, item.axis)
       
@@ -1333,7 +1343,7 @@
           .tooltip(`${item.name}`, (value) => {
             return {
               name: item.name,
-              value: plot.show === 'percent' ? value + '%' : value
+              value: item.show === 'percent' ? value + '%' : value
             }
           })
 
@@ -1342,7 +1352,7 @@
         }
         if (item.label !== 'false') {
           _chart.label(item.name, (value) => {
-            if (plot.show === 'percent') {
+            if (item.show === 'percent') {
               value = value + '%'
             }
             if (plot.label === 'true' && plot.labelColor === 'custom' && item.color) {
@@ -1384,13 +1394,13 @@
           .tooltip(`${item.name}`, (value) => {
             return {
               name: item.name,
-              value: plot.show === 'percent' ? value + '%' : value
+              value: item.show === 'percent' ? value + '%' : value
             }
           })
 
         if (item.label === 'true') {
           _chart.label(item.name, (value) => {
-            if (plot.show === 'percent') {
+            if (item.show === 'percent') {
               value = value + '%'
             }
             return {

--
Gitblit v1.8.0