| | |
| | | |
| | | this.updateComponent(_card, true) |
| | | } else { |
| | | let _card = fromJS(card).toJS() |
| | | if (_card.plot.correction) { |
| | | delete _card.plot.correction // 数据修正(已弃用) |
| | | _card.plot.barSize = 35 |
| | | } |
| | | |
| | | this.setState({ |
| | | card: fromJS(card).toJS() |
| | | card: _card |
| | | }) |
| | | } |
| | | } |
| | |
| | | }) |
| | | } |
| | | |
| | | if (!plot.legend || plot.legend === 'hidden') { |
| | | let noLegend = !plot.legend || plot.legend === 'hidden' |
| | | if (noLegend) { |
| | | chart.legend(false) |
| | | } else { |
| | | chart.legend({ |
| | |
| | | fill: '#fff' |
| | | } |
| | | } |
| | | let label = plot.label |
| | | |
| | | if (Bar_axis.length) { |
| | | if (label === 'false') { |
| | | plot.customs.forEach(item => { |
| | | if (!Bar_axis.includes(item.type)) return |
| | | if (item.label === 'true') { |
| | | label = 'true' |
| | | } |
| | | }) |
| | | } else { |
| | | let reset = true |
| | | plot.customs.forEach(item => { |
| | | if (!Bar_axis.includes(item.type)) return |
| | | if (item.label === 'true') { |
| | | reset = false |
| | | } |
| | | }) |
| | | if (reset) { |
| | | label = 'false' |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (plot.label === 'top') { |
| | | lablecfg.offset = -5 |
| | |
| | | }) |
| | | const dst = new DataSet() |
| | | const dvt = dst.createView().source(data) |
| | | |
| | | // if (plot.mutilBar === 'stack') { |
| | | // Bar_axis.reverse() |
| | | // } |
| | | |
| | | dvt.transform({ |
| | | type: 'fold', |
| | |
| | | } |
| | | view1.axis('value', yc) |
| | | |
| | | // view1.legend(false) |
| | | if (!noLegend) { |
| | | view1.legend(false) |
| | | } |
| | | |
| | | if (plot.mutilBar !== 'stack') { |
| | | let _chart = view1 |
| | |
| | | } else { |
| | | _chart.color('key') |
| | | } |
| | | if (plot.label !== 'false') { |
| | | if (label !== 'false') { |
| | | _chart.label('value*key', (value, key) => { |
| | | if (plot.show === 'percent') { |
| | | value = value + '%' |
| | | } |
| | | |
| | | if (plot.label === 'true' && plot.labelColor === 'custom' && colors.has(key)) { |
| | | if (label === 'true' && plot.labelColor === 'custom' && colors.has(key)) { |
| | | lablecfg.style.fill = colors.get(key) |
| | | } |
| | | return { |
| | |
| | | }) |
| | | } |
| | | |
| | | if (plot.barSize || plot.correction) { |
| | | if (plot.barSize) { |
| | | _chart.size(plot.barSize || 35) |
| | | } |
| | | if (plot.barRadius) { |
| | |
| | | } else { |
| | | _chart.color('key') |
| | | } |
| | | if (plot.label !== 'false') { |
| | | if (label !== 'false') { |
| | | _chart.label('value*key', (value, key) => { |
| | | if (plot.show === 'percent') { |
| | | value = value + '%' |
| | | } |
| | | |
| | | if (plot.label === 'true' && plot.labelColor === 'custom' && colors.has(key)) { |
| | | if (label === 'true' && plot.labelColor === 'custom' && colors.has(key)) { |
| | | lablecfg.style.fill = colors.get(key) |
| | | } |
| | | |
| | |
| | | }) |
| | | } |
| | | |
| | | if (plot.barSize || plot.correction) { |
| | | if (plot.barSize) { |
| | | _chart.size(plot.barSize || 35) |
| | | } |
| | | if (plot.barRadius) { |
| | |
| | | |
| | | view2.data(dv.rows) |
| | | |
| | | // view2.legend(false) |
| | | if (!noLegend && Bar_axis.length) { |
| | | view2.legend(false) |
| | | } |
| | | |
| | | fields.forEach(item => { |
| | | if (item.chartType === 'bar' && !Bar_axis.length) { |
| | |
| | | }) |
| | | } |
| | | |
| | | if (plot.barSize || plot.correction) { |
| | | if (plot.barSize) { |
| | | _chart.size(plot.barSize || 35) |
| | | } |
| | | if (plot.selectColor) { |
| | |
| | | }) |
| | | } |
| | | |
| | | if (plot.barSize || plot.correction) { |
| | | if (plot.barSize) { |
| | | _chart.size(plot.barSize || 35) |
| | | } |
| | | if (plot.selectColor) { |
| | |
| | | this.updateComponent(_card) |
| | | } |
| | | |
| | | plotchange = (card) => { |
| | | if (card.plot.enabled === 'true' && card.plot.zoomYaxis !== 'custom' && card.plot.customs) { |
| | | card.plot.customs.forEach(item => { |
| | | item.min = '' |
| | | item.max = '' |
| | | }) |
| | | } |
| | | |
| | | if (card.plot.barcolors && (card.plot.enabled === 'true' || card.plot.datatype === 'statistics')) { |
| | | card.plot.barcolors = null |
| | | } |
| | | |
| | | this.updateComponent(card) |
| | | } |
| | | |
| | | clickComponent = (e) => { |
| | | if (sessionStorage.getItem('style-control') === 'true' || sessionStorage.getItem('style-control') === 'component') { |
| | | e.stopPropagation() |
| | |
| | | <div className="mk-popover-control"> |
| | | {appType !== 'mob' ? <PlusCircleOutlined className="plus" title="添加搜索" onClick={this.addSearch}/> : null} |
| | | {appType !== 'mob' ? <PlusSquareOutlined className="plus" title="添加按钮" onClick={this.addButton}/> : null} |
| | | <ChartCompileForm config={card} plotchange={this.updateComponent}/> |
| | | <ChartCompileForm config={card} plotchange={this.plotchange}/> |
| | | <CopyComponent type="line" card={card}/> |
| | | <PasteComponent config={card} options={['action', 'search']} updateConfig={this.updateComponent} /> |
| | | <FontColorsOutlined className="style" title="调整样式" onClick={this.changeStyle}/> |