king
2023-11-21 41accaed7b2260f9033701f048b5b65b01a6369d
src/tabviews/custom/components/chart/antv-bar-line/index.jsx
@@ -160,6 +160,12 @@
        _config.plot.$label = label
      }
      if (_config.plot.zoomYaxis === 'adjust' && _config.plot.mutilBar === 'stack') {
        if (_config.plot.Bar_axis) {
          _config.plot.zoomFields = _config.plot.Yaxis.filter(cell => !_config.plot.Bar_axis.includes(cell))
        }
      }
    } else {
      _config.plot.enabled = 'false'
    }
@@ -1191,6 +1197,41 @@
   */
  customrender = (data) => {
    const { plot, transfield } = this.state
    let max = 0
    if (plot.zoomYaxis === 'adjust') {
      data.forEach(item => {
        if (plot.zoomFields) {
          plot.zoomFields.forEach(f => {
            if (item[f] > max) {
              max = item[f]
            }
          })
          let sum = 0
          plot.Bar_axis.forEach(f => {
            sum += item[f]
          })
          if (sum > max) {
            max = sum
          }
        } else {
          plot.Yaxis.forEach(f => {
            if (item[f] > max) {
              max = item[f]
            }
          })
        }
      })
      if (!isNaN(max)) {
        max = Math.ceil(max)
        let s = Math.pow(10, (max + '').length - 1)
        max = Math.ceil(max / s) * s
      } else {
        max = 0
      }
    }
    const ds = new DataSet()
    const dv = ds.createView().source(data)
@@ -1303,11 +1344,19 @@
        range: [0, 0.9]
      }
  
      if (plot.min || plot.min === 0) {
        c.min = plot.min
      }
      if (plot.max || plot.max === 0) {
        c.max = plot.max
      if (plot.zoomYaxis === 'adjust') {
        if (max) {
          c.min = 0
          c.max = max
        }
      } else {
        if (plot.min || plot.min === 0) {
          c.min = plot.min
        }
        if (plot.max || plot.max === 0) {
          c.max = plot.max
          c.min = c.min || 0
        }
      }
      view1.scale('value', c)
      view1.axis('value', plot.$yc)
@@ -1318,7 +1367,7 @@
      let colorIndex = 0
  
      if (plot.adjust !== 'stack') {
      if (plot.mutilBar !== 'stack') {
        let _chart = view1
          .interval()
          .position(`${plot.Xaxis}*value`)
@@ -1386,7 +1435,7 @@
        if (plot.barRadius) {
          _chart.style({ radius: [plot.barRadius, plot.barRadius, 0, 0] })
        }
      } else if (plot.adjust === 'stack') {
      } else if (plot.mutilBar === 'stack') {
        let _chart = view1
          .interval()
          .position(`${plot.Xaxis}*value`)
@@ -1478,11 +1527,18 @@
          range: [0, 0.9]
        }
    
        if (item.min || item.min === 0) {
          c.min = item.min
        }
        if (item.max || item.max === 0) {
          c.max = item.max
        if (plot.zoomYaxis === 'adjust') {
          if (max) {
            c.min = 0
            c.max = max
          }
        } else {
          if (item.min || item.min === 0) {
            c.min = item.min
          }
          if (item.max || item.max === 0) {
            c.max = item.max
          }
        }
        view2.scale(item.name, c)
@@ -1544,11 +1600,18 @@
          range: [0, 0.9]
        }
    
        if (item.min || item.min === 0) {
          c.min = item.min
        }
        if (item.max || item.max === 0) {
          c.max = item.max
        if (plot.zoomYaxis === 'adjust') {
          if (max) {
            c.min = 0
            c.max = max
          }
        } else {
          if (item.min || item.min === 0) {
            c.min = item.min
          }
          if (item.max || item.max === 0) {
            c.max = item.max
          }
        }
        view2.scale(item.name, c)
@@ -1695,6 +1758,7 @@
    }
    if (plot.max || plot.max === 0) {
      c.max = plot.max
      c.min = c.min || 0
    }
    chart.scale(_valfield, c)