| | |
| | | import { Chart } from '@antv/g2' |
| | | import DataSet from '@antv/data-set' |
| | | |
| | | import zhCN from '@/locales/zh-CN/model.js' |
| | | import enUS from '@/locales/en-US/model.js' |
| | | import ChartCompileForm from './chartcompile' |
| | | import './index.scss' |
| | | |
| | |
| | | } |
| | | |
| | | state = { |
| | | dict: (!localStorage.getItem('lang') || localStorage.getItem('lang') === 'zh-CN') ? zhCN : enUS, |
| | | visible: true |
| | | } |
| | | |
| | |
| | | if (plot.label === 'true') { |
| | | _chart.label('value') |
| | | } |
| | | if (plot.barSize || plot.correction) { |
| | | _chart.size(plot.barSize || 35) |
| | | } |
| | | } else if (plot.adjust === 'stack') { |
| | | let _chart = chart |
| | | .interval() |
| | |
| | | |
| | | if (plot.label === 'true') { |
| | | _chart.label('value') |
| | | } |
| | | |
| | | if (plot.barSize || plot.correction) { |
| | | _chart.size(plot.barSize || 35) |
| | | } |
| | | } |
| | | |
| | |
| | | type: 'overlap' |
| | | } |
| | | setting.offset = 0 |
| | | // setting.style = { |
| | | // textAlign: 'center', |
| | | // fontSize: 12, |
| | | // fill: '#535353' |
| | | // } |
| | | } |
| | | |
| | | _chart.label('percent', setting) |
| | |
| | | this.props.plotchange({...config, charts: _charts}) |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | | return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState)) |
| | | } |
| | | |
| | | render() { |
| | | const { plot } = this.props |
| | | |
| | |
| | | plot={plot} |
| | | type={plot.chartType} |
| | | config={this.props.config} |
| | | dict={this.state.dict} |
| | | plotchange={this.plotChange} |
| | | /> |
| | | </div> |