king
2021-06-04 9e60fb89a8b1c8a1d16b557b20b6d0a509f37983
src/tabviews/custom/components/chart/antv-pie/index.jsx
@@ -514,6 +514,17 @@
    let type = plot.type
    let color = plot.color
    let colors = new Map()
    let colorIndex = 0
    if (plot.colors && plot.colors.length > 0) {
      plot.colors.forEach(item => {
        if (!colors.has(item.label)) {
          colors.set(item.label, item.color)
        }
      })
    }
    let _data = this.getnestdata()
    const dvx = new DataView().source(_data)
@@ -577,7 +588,6 @@
      .interval()
      .adjust('stack')
      .position(Y_axis)
      .color(type)
      .tooltip(`${type}*${Y_axis}`, (type, percent) => {
        if (plot.show !== 'value') {
          percent = (percent * 100).toFixed(2) + '%'
@@ -591,6 +601,19 @@
        lineWidth: 1,
        stroke: '#fff',
      })
    if (plot.colors && plot.colors.length > 0) {
      let limit = chartColors.length
      chart1.color(type, (_type) => {
        if (colors.has(_type)) {
          return colors.get(_type)
        } else {
          colorIndex++
          return chartColors[(colorIndex - 1) % limit]
        }
      })
    } else {
      chart1.color(type)
    }
    if (plot.label !== 'false') {
      chart1.label(type, {
@@ -618,7 +641,6 @@
      .interval()
      .adjust('stack')
      .position(Y_axis)
      .color(X_axis)
      .tooltip(`${X_axis}*${Y_axis}`, (name, value) => {
        if (plot.show !== 'value') {
          value = (value * 100).toFixed(2) + '%'
@@ -632,6 +654,20 @@
        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]
          }
        })
      } else {
        chart2.color(X_axis)
      }
      if (plot.label !== 'false') {
        if (plot.label === 'inner') {
@@ -810,11 +846,11 @@
      if (plot.colors && plot.colors.length > 0) {
        let limit = chartColors.length
        _chart.color(X_axis, (type) => {
          if (colors.get(type)) {
          if (colors.has(type)) {
            return colors.get(type)
          } else {
            colors.set(type, chartColors[colorIndex % limit])
            colorIndex++
            return chartColors[(colorIndex - 1) % limit]
          }
        })
      } else {
@@ -877,11 +913,11 @@
      if (plot.colors && plot.colors.length > 0) {
        let limit = chartColors.length
        _chart.color(X_axis, (type) => {
          if (colors.get(type)) {
          if (colors.has(type)) {
            return colors.get(type)
          } else {
            colors.set(type, chartColors[colorIndex % limit])
            colorIndex++
            return chartColors[(colorIndex - 1) % limit]
          }
        })
      } else {