king
2023-02-09 4453a9e63e8e176c70c432b03fd4ba3ebf00a04c
src/tabviews/custom/components/chart/antv-bar-line/index.jsx
@@ -1478,6 +1478,7 @@
    let _valfield = 'value'
    let _typefield = 'key'
    let colorIndex = 0
    let barcolors = {}
    if (plot.datatype === 'statistics') {
      _valfield = plot.InfoValue
@@ -1490,6 +1491,16 @@
      if (plot.enabled === 'true') {
        this.customrender(data)
        return
      }
      if (plot.barcolors && plot.barcolors.length > 0 && plot.Yaxis.length === 1) {
        data.forEach((item, i) => {
          if (plot.barcolors[i]) {
            barcolors[item[plot.Xaxis]] = plot.barcolors[i].color
          }
        })
      } else {
        barcolors = null
      }
      const ds = new DataSet()
@@ -1624,7 +1635,20 @@
      if (plot.$colors) {
        let limit = chartColors.length
        _chart.color(_typefield, (key) => {
        if (barcolors) {
          _chart.color(`${_typefield}*${plot.Xaxis}`, (key, label) => {
            if (barcolors[label]) {
              return barcolors[label]
            } else if (plot.$colors.has(key)) {
              return plot.$colors.get(key)
            } else {
              colorIndex++
              return chartColors[(colorIndex - 1) % limit]
            }
          })
        } else {
          _chart.color(`${_typefield}`, (key) => {
          if (plot.$colors.has(key)) {
            return plot.$colors.get(key)
          } else {
@@ -1632,6 +1656,7 @@
            return chartColors[(colorIndex - 1) % limit]
          }
        })
        }
      } else {
        _chart.color(_typefield)
      }
@@ -1686,7 +1711,19 @@
      if (plot.$colors) {
        let limit = chartColors.length
        _chart.color(_typefield, (key) => {
        if (barcolors) {
          _chart.color(`${_typefield}*${plot.Xaxis}`, (key, label) => {
            if (barcolors[label]) {
              return barcolors[label]
            } else if (plot.$colors.has(key)) {
              return plot.$colors.get(key)
            } else {
              colorIndex++
              return chartColors[(colorIndex - 1) % limit]
            }
          })
        } else {
          _chart.color(`${_typefield}`, (key) => {
          if (plot.$colors.has(key)) {
            return plot.$colors.get(key)
          } else {
@@ -1694,6 +1731,7 @@
            return chartColors[(colorIndex - 1) % limit]
          }
        })
        }
      } else {
        _chart.color(_typefield)
      }