| | |
| | | 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' |
| | | |
| | |
| | | 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 |
| | |
| | | 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] |
| | | } |
| | | }) |
| | | } |
| | |
| | | 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 => { |
| | |
| | | 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({ |