| | |
| | | |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | |
| | | import zhCN from '@/locales/zh-CN/mob.js' |
| | | import enUS from '@/locales/en-US/mob.js' |
| | | // import ChartCompileForm from './chartcompile' |
| | | import zhCN from '@/locales/zh-CN/model.js' |
| | | import enUS from '@/locales/en-US/model.js' |
| | | import './index.scss' |
| | | |
| | | const SettingComponent = asyncComponent(() => import('@/menu/datasourcecomponent')) |
| | | const SearchComponent = asyncComponent(() => import('@/menu/searchcomponent')) |
| | | const ActionComponent = asyncComponent(() => import('@/menu/actioncomponent')) |
| | | const ChartCompileForm = asyncComponent(() => import('./chartcompile')) |
| | | |
| | | class antvBarLineChart extends Component { |
| | | static propTpyes = { |
| | |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | const { card, config } = this.props |
| | | const { card } = this.props |
| | | |
| | | console.log(config) |
| | | if (card.isNew) { |
| | | let _plot = { |
| | | chartType: card.type, // 图表类型 |
| | | enabled: 'false', // 是否使用自定义设置 |
| | | datatype: 'query', // 数据类型查询或统计 |
| | | } |
| | | |
| | | if (card.subtype === 'bar') { |
| | | _plot.coordinate = 'angle' // 二维坐标或极坐标 |
| | | _plot.transpose = 'false' // 坐标轴变换 |
| | | } else if (card.subtype === 'bar1') { |
| | | _plot.coordinate = 'angle' |
| | | _plot.transpose = 'true' |
| | | } |
| | | |
| | | let _card = { |
| | | uuid: card.uuid, |
| | | type: card.type, |
| | |
| | | scripts: [], |
| | | search: [], |
| | | action: [], |
| | | plot: {type: card.type, Xaxis: '', Yaxis: null} |
| | | plot: _plot |
| | | } |
| | | this.setState({ |
| | | card: _card |
| | |
| | | viewrender = () => { |
| | | const { card } = this.state |
| | | |
| | | if (card.plot.type === 'line') { |
| | | if (card.plot.chartType === 'line') { |
| | | this.linerender() |
| | | } else if (card.plot.type === 'bar') { |
| | | } else if (card.plot.chartType === 'bar') { |
| | | this.barrender() |
| | | } |
| | | } |
| | |
| | | let Y_axis = plot.Yaxis || ['y'] |
| | | |
| | | let data = this.getdata(X_axis, Y_axis) |
| | | console.log(plot) |
| | | console.log(data) |
| | | |
| | | if (plot.enabled !== 'true') { |
| | | const ds = new DataSet() |
| | |
| | | height: plot.height || 400 |
| | | }) |
| | | |
| | | console.log(dv.rows) |
| | | chart.data(dv.rows) |
| | | |
| | | chart.scale('value', { |
| | |
| | | <div className="chart-header"> |
| | | <span className="chart-title">{card.setting.title || ''}</span> |
| | | <SearchComponent |
| | | menu={{MenuID: config.uuid, MenuName: config.MenuName}} |
| | | menu={config} |
| | | config={card} |
| | | sysRoles={config.sysRoles} |
| | | optionLibs={null} |
| | |
| | | /> |
| | | </div> |
| | | <ActionComponent |
| | | menu={{ MenuID: config.uuid, MenuName: config.MenuName, MenuNo: config.MenuNo, fstMenuList: config.fstMenuList }} |
| | | type="chart" |
| | | menu={config} |
| | | config={card} |
| | | tabs={[]} |
| | | usefulFields={config.permFuncField || []} |
| | |
| | | updateaction={this.updateComponent} |
| | | /> |
| | | <div className="canvas" id={card.uuid}></div> |
| | | {/* <ChartCompileForm |
| | | plot={plot} |
| | | type={plot.chartType} |
| | | config={this.props.config} |
| | | <ChartCompileForm |
| | | config={card} |
| | | dict={this.state.dict} |
| | | plotchange={this.plotChange} |
| | | /> */} |
| | | plotchange={this.updateComponent} |
| | | /> |
| | | </div> |
| | | ) |
| | | } |