From c6f7462d80ab626174329b69045fb7e5704c0683 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期六, 05 六月 2021 22:44:17 +0800
Subject: [PATCH] 2021-06-05

---
 src/tabviews/custom/components/chart/antv-pie/index.jsx |  177 +++++++++++++++++++++++++++++++++--------------------------
 1 files changed, 99 insertions(+), 78 deletions(-)

diff --git a/src/tabviews/custom/components/chart/antv-pie/index.jsx b/src/tabviews/custom/components/chart/antv-pie/index.jsx
index 05b7249..ec281d5 100644
--- a/src/tabviews/custom/components/chart/antv-pie/index.jsx
+++ b/src/tabviews/custom/components/chart/antv-pie/index.jsx
@@ -597,18 +597,22 @@
           value: percent,
         }
       })
-      .style({
-        lineWidth: 1,
-        stroke: '#fff',
+    if (plot.splitLine) {
+      chart1.style({
+        lineWidth: plot.splitLine,
+        stroke: plot.splitColor,
       })
+    }
     if (plot.colors && plot.colors.length > 0) {
       let limit = chartColors.length
       chart1.color(type, (_type) => {
         if (colors.has(_type)) {
           return colors.get(_type)
         } else {
+          let _c = chartColors[colorIndex % limit]
+          colors.set(type, _c)
           colorIndex++
-          return chartColors[(colorIndex - 1) % limit]
+          return _c
         }
       })
     } else {
@@ -650,82 +654,86 @@
           value: value
         }
       })
-      .style({
-        lineWidth: 1,
-        stroke: '#fff',
-      })
 
-      if (plot.colors && plot.colors.length > 0) {
-        let limit = chartColors.length
-        chart2.color(X_axis, (type) => {
-          if (colors.has(type)) {
-            return colors.get(type)
-          } else {
-            colorIndex++
-            return chartColors[(colorIndex - 1) % limit]
+    if (plot.splitLine) {
+      chart2.style({
+        lineWidth: plot.splitLine,
+        stroke: plot.splitColor,
+      })
+    }
+    if (plot.colors && plot.colors.length > 0) {
+      let limit = chartColors.length
+      chart2.color(X_axis, (type) => {
+        if (colors.has(type)) {
+          return colors.get(type)
+        } else {
+          let _c = chartColors[colorIndex % limit]
+          colors.set(type, _c)
+          colorIndex++
+          return _c
+        }
+      })
+    } else {
+      chart2.color(X_axis)
+    }
+
+    if (plot.label !== 'false') {
+      if (plot.label === 'inner') {
+        chart2.label(Y_axis, {
+          offset: -30,
+          content: (data) => {
+            let _label = ''
+            let _val = ''
+            if (plot.show !== 'value') {
+              _val = `${(data[Y_axis] * 100).toFixed(2)}%`
+            } else {
+              _val = `${data[Y_axis]}`
+            }
+            if (plot.label === 'inner') {
+              _label = _val
+            } else {
+              _label = `${data[X_axis]}: ${_val}`
+            }
+            return _label
+          },
+          style: {
+            textAlign: 'center',
+            fontSize: 16,
+            shadowBlur: 2,
+            shadowColor: 'rgba(0, 0, 0, .45)',
+            fill: '#fff',
           }
         })
       } else {
-        chart2.color(X_axis)
-      }
-
-      if (plot.label !== 'false') {
-        if (plot.label === 'inner') {
-          chart2.label(Y_axis, {
-            offset: -30,
-            content: (data) => {
-              let _label = ''
-              let _val = ''
-              if (plot.show !== 'value') {
-                _val = `${(data[Y_axis] * 100).toFixed(2)}%`
-              } else {
-                _val = `${data[Y_axis]}`
-              }
-              if (plot.label === 'inner') {
-                _label = _val
-              } else {
-                _label = `${data[X_axis]}: ${_val}`
-              }
-              return _label
-            },
-            style: {
-              textAlign: 'center',
-              fontSize: 16,
-              shadowBlur: 2,
-              shadowColor: 'rgba(0, 0, 0, .45)',
-              fill: '#fff',
+        chart2.label(Y_axis, {
+          layout: { type: 'pie-spider' },
+          labelHeight: 20,
+          content: (data) => {
+            let _label = ''
+            let _val = ''
+            if (plot.show !== 'value') {
+              _val = `${(data[Y_axis] * 100).toFixed(2)}%`
+            } else {
+              _val = `${data[Y_axis]}`
             }
-          })
-        } else {
-          chart2.label(Y_axis, {
-            layout: { type: 'pie-spider' },
-            labelHeight: 20,
-            content: (data) => {
-              let _label = ''
-              let _val = ''
-              if (plot.show !== 'value') {
-                _val = `${(data[Y_axis] * 100).toFixed(2)}%`
-              } else {
-                _val = `${data[Y_axis]}`
-              }
-              if (plot.label === 'inner') {
-                _label = _val
-              } else {
-                _label = `${data[X_axis]}: ${_val}`
-              }
-              return _label
-            },
-            labelLine: {
-              style: {
-                lineWidth: 0.5,
-              },
-            },
-            style: {
-              fill: color
+            if (plot.label === 'inner') {
+              _label = _val
+            } else {
+              _label = `${data[X_axis]}: ${_val}`
             }
-          })
-        }
+            return _label
+          },
+          labelLine: {
+            style: {
+              lineWidth: 0.5,
+            },
+          },
+          style: {
+            fill: color
+          }
+        })
       }
+    }
     if (plot.interaction && plot.interaction.length) {
       plot.interaction.forEach(t => {
         chart.interaction(t)
@@ -845,14 +853,23 @@
             value: value
           }
         })
+
+      if (plot.splitLine) {
+        _chart.style({
+          lineWidth: plot.splitLine,
+          stroke: plot.splitColor,
+        })
+      }
       if (plot.colors && plot.colors.length > 0) {
         let limit = chartColors.length
         _chart.color(X_axis, (type) => {
           if (colors.has(type)) {
             return colors.get(type)
           } else {
+            let _c = chartColors[colorIndex % limit]
+            colors.set(type, _c)
             colorIndex++
-            return chartColors[(colorIndex - 1) % limit]
+            return _c
           }
         })
       } else {
@@ -916,8 +933,10 @@
           if (colors.has(type)) {
             return colors.get(type)
           } else {
+            let _c = chartColors[colorIndex % limit]
+            colors.set(type, _c)
             colorIndex++
-            return chartColors[(colorIndex - 1) % limit]
+            return _c
           }
         })
       } else {
@@ -934,9 +953,11 @@
         }
 
         _chart.label(X_axis, _label)
-        .style({
-          lineWidth: 1,
-          stroke: '#fff',
+      }
+      if (plot.splitLine) {
+        _chart.style({
+          lineWidth: plot.splitLine,
+          stroke: plot.splitColor,
         })
       }
     }

--
Gitblit v1.8.0