king
2023-11-22 1b6086e0fb66410fb237e6893f791a26bf2e7ff1
src/menu/components/chart/antv-bar/chartcompile/index.jsx
@@ -1,6 +1,6 @@
import React, {Component} from 'react'
import PropTypes from 'prop-types'
import { is, fromJS } from 'immutable'
import { fromJS } from 'immutable'
import { Modal, Form, Row, Col, Select, Radio, notification, Tooltip, Input, InputNumber, Tabs, Button } from 'antd'
import { QuestionCircleOutlined, EditOutlined, PlusOutlined } from '@ant-design/icons'
@@ -566,17 +566,14 @@
        if (!err) {
          let _plot = {...plot, ...values}
          if (values.datatype !== plot.datatype) {
          if (_plot.datatype !== plot.datatype) {
            _plot.colors = null
          }
          if (values.datatype === 'statistics') {
          if (_plot.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
          } else if (_plot.Yaxis) {
            let labels = {}
            config.columns.forEach(col => {
              labels[col.field] = col.label
@@ -597,6 +594,24 @@
                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]
              }
            })
          }
@@ -671,21 +686,19 @@
        if (!err) {
          let _plot = {...plot, ...values}
          if (_plot.datatype !== plot.datatype) {
            _plot.colors = null
          }
          if (_plot.datatype === 'statistics') {
            _plot.enabled = 'false'
            _plot.customs = []
            _plot.colors = _plot.colors || []
            delete _plot.Yaxis
          } else if (_plot.Yaxis) {
          let labels = {}
          config.columns.forEach(col => {
            labels[col.field] = col.label
          })
          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 => {
@@ -704,14 +717,16 @@
                shape: _plot.chartType === 'bar' && i === 0 ? ['bar', 'rect'] : ['line', 'smooth']
              }
            })
          }
          if (!_plot.colors) {
            _plot.colors = []
            if (_plot.datatype === 'query') {
            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,
@@ -720,7 +735,6 @@
                  color1: chartColors[i % limit]
                }
              })
            }
          }
          this.setState({