king
2020-11-12 f830c733cbc071f023c9a9a4e1571b7c81d672bf
src/tabviews/custom/components/chart/antv-bar-line/index.jsx
@@ -127,14 +127,8 @@
    }, () => {
      if (config.setting.sync !== 'true' && config.setting.onload === 'true') {
        this.loadData()
      } else if (config.setting.sync === 'true') {
        if (!_data) {
          this.setState({
            loading: true
          })
        } else {
          this.handleData()
        }
      } else if (config.setting.sync === 'true' && _data) {
        this.handleData()
      }
    })
  }
@@ -158,7 +152,7 @@
        _data = nextProps.data[config.dataName] || []
      }
      this.setState({sync: false, loading: false, data: _data}, () => {
      this.setState({sync: false, data: _data}, () => {
        this.handleData()
      })
    } else if (!is(fromJS(this.props.mainSearch), fromJS(nextProps.mainSearch))) {
@@ -351,22 +345,6 @@
      })
      _data = [..._mdata.values()]
    }
    if (plot.correction && plot.chartType === 'bar' && _data.length > 0 && _data.length < plot.correction) {
      if (plot.enabled !== 'true' || (plot.customs && plot.customs.filter(cell => cell.chartType !== 'bar').length === 0)) {
        let _num = plot.correction - _data.length
        for (let i = 0; i < _num; i++) {
          let _val = Array( i + 2 ).join(' ')
          let _cell = {}
          _cell[plot.Xaxis] = _val
          vFields.forEach(col => {
            _cell[col.field] = ''
          })
          _data.push(_cell)
        }
      }
    }
    this.setState({empty: _data.length === 0})
@@ -1003,6 +981,10 @@
      if (plot.label === 'true') {
        _chart.label(_valfield)
      }
      if (plot.barSize || plot.correction) {
        _chart.size(plot.barSize || 35)
      }
    } else if (plot.adjust === 'stack') {
      let _chart = chart
        .interval()
@@ -1020,6 +1002,10 @@
      if (plot.label === 'true') {
        _chart.label(_valfield)
      }
      if (plot.barSize || plot.correction) {
        _chart.size(plot.barSize || 35)
      }
    }
    chart.render()