king
2021-06-05 c6f7462d80ab626174329b69045fb7e5704c0683
src/menu/components/chart/antv-pie/index.jsx
@@ -289,11 +289,13 @@
          value: percent,
        }
      })
      .style({
        lineWidth: 1,
        stroke: '#fff',
      })
    if (plot.splitLine) {
      chart1.style({
        lineWidth: plot.splitLine,
        stroke: plot.splitColor,
      })
    }
    if (plot.label !== 'false') {
      chart1.label(type, {
        offset: -10,
@@ -330,68 +332,71 @@
          value: value
        }
      })
      .style({
        lineWidth: 1,
        stroke: '#fff',
      })
      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',
    if (plot.splitLine) {
      chart2.style({
        lineWidth: plot.splitLine,
        stroke: plot.splitColor,
      })
    }
    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]}`
            }
          })
        } 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
          },
          style: {
            textAlign: 'center',
            fontSize: 16,
            shadowBlur: 2,
            shadowColor: 'rgba(0, 0, 0, .45)',
            fill: '#fff',
          }
        })
      } 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.interaction && plot.interaction.length) {
      plot.interaction.forEach(t => {
@@ -488,6 +493,7 @@
      })
    }
    // 饼图或环图
    if (plot.shape !== 'nightingale') {
      let _chart = chart
        .interval()
@@ -503,6 +509,14 @@
            value: value
          }
        })
      if (plot.splitLine) {
        _chart.style({
          lineWidth: plot.splitLine,
          stroke: plot.splitColor,
        })
      }
      if (plot.label !== 'false') {
        if (plot.label === 'inner') {
          _chart.label(Y_axis, {
@@ -578,9 +592,11 @@
          }
          _chart.label(X_axis, _label)
          .style({
            lineWidth: 1,
            stroke: '#fff',
        }
        if (plot.splitLine) {
          _chart.style({
            lineWidth: plot.splitLine,
            stroke: plot.splitColor,
          })
        }
    }