king
2023-11-22 1b6086e0fb66410fb237e6893f791a26bf2e7ff1
2023-11-22
3个文件已修改
97 ■■■■■ 已修改文件
src/menu/components/chart/antv-bar/chartcompile/index.jsx 78 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/components/chart/antv-bar/index.jsx 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/custom/components/chart/antv-bar-line/index.jsx 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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}
          let labels = {}
          config.columns.forEach(col => {
            labels[col.field] = col.label
          })
          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 = []
            _plot.colors = _plot.colors || []
            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
            })
            let cus = {}
            _plot.customs && _plot.customs.forEach(m => {
@@ -704,23 +717,24 @@
                shape: _plot.chartType === 'bar' && i === 0 ? ['bar', 'rect'] : ['line', 'smooth']
              }
            })
          }
          if (!_plot.colors) {
            _plot.colors = []
            if (_plot.datatype === 'query') {
              let limit = chartColors.length
            let cusColor = {}
            let limit = chartColors.length
              _plot.colors = _plot.Yaxis.map((item, i) => {
                return {
                  uuid: Utils.getuuid(),
                  type: item,
                  label: labels[item] || item,
                  color: chartColors[i % limit],
                  color1: chartColors[i % limit]
                }
              })
            }
            _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
@@ -796,7 +796,7 @@
    view2.data(dv.rows)
    if (!noLegend) {
    if (!noLegend && Bar_axis.length) {
      view2.legend(false)
    }
src/tabviews/custom/components/chart/antv-bar-line/index.jsx
@@ -100,6 +100,10 @@
    _config.style.height = 'auto'
    _config.style.minHeight = _config.plot.height + 30
    if (!_config.plot.legend || _config.plot.legend === 'hidden') {
      _config.plot.legend = false
    }
    if (_config.plot.title) {
      _config.style.minHeight = _config.style.minHeight + 45
    }
@@ -1050,7 +1054,7 @@
    chart.axis(plot.Xaxis, plot.$xc)
    chart.axis(_valfield, plot.$yc)
    if (!plot.legend || plot.legend === 'hidden') {
    if (!plot.legend) {
      chart.legend(false)
    } else {
      chart.legend({
@@ -1225,7 +1229,7 @@
      if (!isNaN(max)) {
        max = Math.ceil(max)
        let s = Math.pow(10, (max + '').length - 1)
        let s = max > 10 ? Math.pow(10, (max + '').length - 2) : 1
        max = Math.ceil(max / s) * s
      } else {
        max = 0
@@ -1266,8 +1270,7 @@
      })
    }
    let noLegend = !plot.legend || plot.legend === 'hidden'
    if (noLegend) {
    if (!plot.legend) {
      chart.legend(false)
    } else {
      chart.legend({
@@ -1361,7 +1364,7 @@
      view1.scale('value', c)
      view1.axis('value', plot.$yc)
  
      if (!noLegend) {
      if (plot.legend) {
        view1.legend(false)
      }
@@ -1514,7 +1517,7 @@
    view2.data(dv.rows)
    if (!noLegend) {
    if (plot.legend && plot.Bar_axis) {
      view2.legend(false)
    }
@@ -1765,7 +1768,7 @@
    chart.axis(plot.Xaxis, plot.$xc)
    chart.axis(_valfield, plot.$yc)
    if (!plot.legend || plot.legend === 'hidden') {
    if (!plot.legend) {
      chart.legend(false)
    } else {
      chart.legend({