king
2022-05-19 15acad2194d616b37d85dd6192bc5656403f1a83
src/menu/components/chart/antv-bar/chartcompile/index.jsx
@@ -497,17 +497,39 @@
        if (!err) {
          let _plot = {...plot, ...values}
          if (values.datatype === 'statistics' || values.datatype !== plot.datatype) {
            _plot.enabled = 'false'
            _plot.customs = []
          } else if (!values.Yaxis || !plot.Yaxis || !is(fromJS(values.Yaxis), fromJS(plot.Yaxis))) {
            _plot.enabled = 'false'
            _plot.customs = []
            _plot.colors = null
          }
          if (values.datatype !== plot.datatype) {
            _plot.colors = null
          }
          if (values.datatype === 'statistics') {
            _plot.enabled = 'false'
            _plot.customs = []
            delete _plot.Yaxis
          } else if (!is(fromJS(values.Yaxis), fromJS(plot.Yaxis || []))) {
            _plot.enabled = 'false'
            _plot.colors = null
            let labels = {}
            config.columns.forEach(col => {
              labels[col.field] = col.label
            })
            let cus = {}
            _plot.customs && _plot.customs.forEach(m => {
              cus[m.type] = m
            })
            _plot.customs = _plot.Yaxis.map((item, i) => {
              if (cus[item]) return cus[item]
              return {
                uuid: Utils.getuuid(),
                type: item,
                name: labels[item] || item,
                axis: i === 0 ? 'true' : 'false',
                label: 'false',
                title: 'true',
                shape: _plot.chartType === 'bar' && i === 0 ? ['bar', 'rect'] : ['line', 'smooth']
              }
            })
          }
          this.setState({
@@ -580,22 +602,29 @@
        if (!err) {
          let _plot = {...plot, ...values}
          if (values.datatype === 'statistics' || values.datatype !== plot.datatype) {
            _plot.enabled = 'false'
            _plot.customs = []
          } else if (!values.Yaxis || !plot.Yaxis || !is(fromJS(values.Yaxis), fromJS(plot.Yaxis))) {
            _plot.enabled = 'false'
            _plot.customs = []
            _plot.colors = null
          }
          let labels = {}
          config.columns.forEach(col => {
            labels[col.field] = col.label
          })
          if (values.datatype !== 'statistics' && (!_plot.customs || _plot.customs.length === 0)) {
          if (values.datatype !== plot.datatype) {
            _plot.colors = null
          }
          if (values.datatype === 'statistics') {
            _plot.enabled = 'false'
            _plot.customs = []
            delete _plot.Yaxis
          } else if (!is(fromJS(values.Yaxis), fromJS(plot.Yaxis || []))) {
            _plot.enabled = 'false'
            _plot.colors = null
            let cus = {}
            _plot.customs && _plot.customs.forEach(m => {
              cus[m.type] = m
            })
            _plot.customs = _plot.Yaxis.map((item, i) => {
              if (cus[item]) return cus[item]
              return {
                uuid: Utils.getuuid(),
                type: item,
@@ -607,7 +636,8 @@
              }
            })
          }
          if (values.datatype !== plot.datatype || !_plot.colors) {
          if (!_plot.colors) {
            _plot.colors = []
            if (_plot.datatype === 'query') {
              let limit = chartColors.length