| | |
| | | import DataSet from '@antv/data-set' |
| | | import { Spin, Empty, notification } from 'antd' |
| | | |
| | | // import searchLine from '../../share/searchLine' |
| | | import Api from '@/api' |
| | | import Utils from '@/utils/utils.js' |
| | | import { modifyTabview } from '@/store/action' |
| | | import { chartColors } from '@/utils/option.js' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import UtilsDM from '@/utils/utils-datamanage.js' |
| | | import MKEmitter from '@/utils/events.js' |
| | | import './index.scss' |
| | | |
| | | const NormalHeader = asyncComponent(() => import('@/tabviews/custom/components/share/normalheader')) |
| | | |
| | | class PieChart extends Component { |
| | | static propTpyes = { |
| | |
| | | plot: null, // 图表设置 |
| | | data: null, // 数据 |
| | | search: null, // 搜索条件 |
| | | showHeader: false // 存在标题、搜索、或统计数据时显示 |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | |
| | | _sync = false |
| | | } |
| | | |
| | | let showHeader = false |
| | | if (config.plot.title || config.search.length > 0) { |
| | | showHeader = true |
| | | _config.plot.height = _config.plot.height - 80 |
| | | } else { |
| | | _config.plot.height = _config.plot.height - 30 |
| | |
| | | plot: _config.plot, |
| | | sync: _sync, |
| | | title: config.plot.title, |
| | | search: Utils.initMainSearch(config.search), |
| | | showHeader |
| | | search: Utils.initMainSearch(config.search) |
| | | }, () => { |
| | | if (config.setting.sync !== 'true' && config.setting.onload === 'true') { |
| | | this.loadData() |
| | |
| | | chart.render() |
| | | } |
| | | |
| | | refreshSearch = (list) => { |
| | | this.setState({search: list}, () => { |
| | | this.loadData() |
| | | }) |
| | | } |
| | | |
| | | render() { |
| | | const { showHeader, config, loading, title, empty } = this.state |
| | | const { config, loading, empty, BID } = this.state |
| | | |
| | | return ( |
| | | <div className="custom-pie-chart-plot-box" style={config.style}> |
| | |
| | | <Spin /> |
| | | </div> : null |
| | | } |
| | | {showHeader ? <div className="chart-header" style={config.headerStyle}> |
| | | <span className="chart-title">{title}</span> |
| | | {/* <searchLine /> */} |
| | | </div> : null} |
| | | <NormalHeader config={config} BID={BID} menuType={this.props.menuType} refresh={this.refreshSearch} /> |
| | | <div className="canvas-wrap"> |
| | | <div className={'canvas' + (empty ? ' empty' : '')} id={this.state.chartId}></div> |
| | | </div> |