| | |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Chart, registerShape } from '@antv/g2' |
| | | import { Spin, notification } from 'antd' |
| | | import { Spin, notification, Modal } from 'antd' |
| | | import { DownloadOutlined } from '@ant-design/icons' |
| | | import moment from 'moment' |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | _config.style.height = config.plot.height || 400 |
| | | _config.plot.height = Utils.getHeight(_config.plot.height) |
| | | _config.style.height = 'auto' |
| | | _config.style.minHeight = _config.plot.height + 30 |
| | | |
| | | if (_config.plot.title) { |
| | | _config.style.minHeight = _config.style.minHeight + 45 |
| | | } |
| | | |
| | | this.setState({ |
| | | config: _config, |
| | |
| | | this.setState({sync: false, data: _data}, () => { |
| | | this.handleData() |
| | | }) |
| | | } else if (config.setting.syncRefresh && nextProps.mainSearch && !is(fromJS(this.props.mainSearch), fromJS(nextProps.mainSearch))) { |
| | | } else if (config.setting.useMSearch && nextProps.mainSearch && !is(fromJS(this.props.mainSearch), fromJS(nextProps.mainSearch))) { |
| | | this.setState({}, () => { |
| | | this.loadData() |
| | | }) |
| | |
| | | loading: false |
| | | }) |
| | | this.timer && this.timer.stop() |
| | | notification.error({ |
| | | top: 92, |
| | | message: result.message, |
| | | duration: 10 |
| | | }) |
| | | |
| | | if (result.ErrCode === 'N') { |
| | | Modal.error({ |
| | | title: result.message, |
| | | }) |
| | | } else { |
| | | notification.error({ |
| | | top: 92, |
| | | message: result.message, |
| | | duration: 10 |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | const chart = new Chart({ |
| | | container: chartId, |
| | | autoFit: true, |
| | | height: this.wrap.offsetHeight - 30, |
| | | height: plot.height |
| | | }) |
| | | |
| | | chart.data(data) |
| | |
| | | const chart = new Chart({ |
| | | container: chartId, |
| | | autoFit: true, |
| | | height: this.wrap.offsetHeight - 30, |
| | | height: plot.height, |
| | | padding: [0, 0, 0, 0], |
| | | }) |
| | | chart.data([_data]) |
| | |
| | | </div> : null |
| | | } |
| | | <NormalHeader config={config} /> |
| | | <div className="canvas-wrap" ref={ref => this.wrap = ref}> |
| | | <div className="canvas-wrap"> |
| | | {config.plot.download === 'enable' && this.state.chart ? <DownloadOutlined onClick={this.downloadImage} className="system-color download"/> : null} |
| | | <div className="canvas" id={this.state.chartId}></div> |
| | | </div> |