king
2023-11-22 2ac9fde37a97e1ceb6b05aa9e5b0476a396339a9
2023-11-22
2个文件已修改
174 ■■■■■ 已修改文件
src/menu/components/chart/antv-bar/chartcompile/index.jsx 170 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/components/chart/antv-bar/index.jsx 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/components/chart/antv-bar/chartcompile/index.jsx
@@ -574,46 +574,53 @@
            _plot.customs = []
            delete _plot.Yaxis
          } else if (_plot.Yaxis) {
            let labels = {}
            config.columns.forEach(col => {
              labels[col.field] = col.label
            })
            let yaxis = JSON.parse(JSON.stringify(_plot.Yaxis))
            let caxis = _plot.customs ? _plot.customs.map(m => m.type) : []
            yaxis.sort()
            caxis.sort()
            if (JSON.stringify(yaxis) !== JSON.stringify(caxis)) {
              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']
                }
              })
  
            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']
              }
            })
            let cusColor = {}
            let limit = chartColors.length
            _plot.colors && _plot.colors.forEach(m => {
              cusColor[m.type] = m
            })
            _plot.colors = _plot.Yaxis.map((item, i) => {
              if (cusColor[item]) return cusColor[item]
              return {
                uuid: Utils.getuuid(),
                type: item,
                label: labels[item] || item,
                color: chartColors[i % limit],
                color1: chartColors[i % limit]
              }
            })
              let cusColor = {}
              let limit = chartColors.length
              _plot.colors && _plot.colors.forEach(m => {
                cusColor[m.type] = m
              })
              _plot.colors = _plot.Yaxis.map((item, i) => {
                if (cusColor[item]) return cusColor[item]
                return {
                  uuid: Utils.getuuid(),
                  type: item,
                  label: labels[item] || item,
                  color: chartColors[i % limit],
                  color1: chartColors[i % limit]
                }
              })
            }
          }
          this.setState({
@@ -695,46 +702,53 @@
            _plot.colors = _plot.colors || []
            delete _plot.Yaxis
          } else if (_plot.Yaxis) {
            let labels = {}
            config.columns.forEach(col => {
              labels[col.field] = col.label
            })
            let yaxis = JSON.parse(JSON.stringify(_plot.Yaxis))
            let caxis = _plot.customs ? _plot.customs.map(m => m.type) : []
            yaxis.sort()
            caxis.sort()
            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: _plot.label === 'false' ? 'false' : true,
                title: 'true',
                shape: _plot.chartType === 'bar' && i === 0 ? ['bar', 'rect'] : ['line', 'smooth']
              }
            })
            let cusColor = {}
            let limit = chartColors.length
            _plot.colors && _plot.colors.forEach(m => {
              cusColor[m.type] = m
            })
            _plot.colors = _plot.Yaxis.map((item, i) => {
              if (cusColor[item]) return cusColor[item]
              return {
                uuid: Utils.getuuid(),
                type: item,
                label: labels[item] || item,
                color: chartColors[i % limit],
                color1: chartColors[i % limit]
              }
            })
            if (JSON.stringify(yaxis) !== JSON.stringify(caxis)) {
              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: _plot.label === 'false' ? 'false' : true,
                  title: 'true',
                  shape: _plot.chartType === 'bar' && i === 0 ? ['bar', 'rect'] : ['line', 'smooth']
                }
              })
              let cusColor = {}
              let limit = chartColors.length
              _plot.colors && _plot.colors.forEach(m => {
                cusColor[m.type] = m
              })
              _plot.colors = _plot.Yaxis.map((item, i) => {
                if (cusColor[item]) return cusColor[item]
                return {
                  uuid: Utils.getuuid(),
                  type: item,
                  label: labels[item] || item,
                  color: chartColors[i % limit],
                  color1: chartColors[i % limit]
                }
              })
            }
          }
          this.setState({
src/menu/components/chart/antv-bar/index.jsx
@@ -628,6 +628,10 @@
      })
      const dst = new DataSet()
      const dvt = dst.createView().source(data)
      // if (plot.mutilBar === 'stack') {
      //   Bar_axis.reverse()
      // }
  
      dvt.transform({
        type: 'fold',