From 33e93682aa7e0a129cc73808eb2001b61e48e5ec Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 28 十二月 2023 18:23:12 +0800 Subject: [PATCH] 2023-12-28 --- src/menu/components/chart/antv-pie/index.jsx | 177 ++++------ src/menu/components/chart/antv-scatter/chartcompile/formconfig.jsx | 45 +- src/pc/modulesource/option.jsx | 2 src/menu/components/chart/antv-pie/chartcompile/formconfig.jsx | 277 ++++++++-------- src/components/normalform/modalform/index.jsx | 2 src/menu/components/chart/antv-pie/chartcompile/index.scss | 5 src/menu/components/chart/antv-pie/chartcompile/index.jsx | 200 +----------- src/mob/modulesource/option.jsx | 2 src/tabviews/custom/components/chart/antv-pie/index.jsx | 207 ++++-------- src/menu/modulesource/option.jsx | 2 10 files changed, 327 insertions(+), 592 deletions(-) diff --git a/src/components/normalform/modalform/index.jsx b/src/components/normalform/modalform/index.jsx index 785a379..776c225 100644 --- a/src/components/normalform/modalform/index.jsx +++ b/src/components/normalform/modalform/index.jsx @@ -284,7 +284,7 @@ if (item.type === 'text') { content = (<MKEInput config={item} onChange={(val, defer) => !defer && this.recordChange({[item.field]: val}, item)} onSubmit={this.props.inputSubmit} />) } else if (item.type === 'number') { - content = (<MKNumberInput config={item} onChange={(val, defer) => !defer && this.recordChange({[item.field]: val})} onSubmit={this.props.inputSubmit} />) + content = (<MKNumberInput config={item} onChange={(val, defer) => !defer && this.recordChange({[item.field]: val}, item)} onSubmit={this.props.inputSubmit} />) } else if (item.type === 'select' || item.type === 'multiselect') { content = (<MKSelect config={item} onChange={(val, other) => this.recordChange({[item.field]: val, ...other}, item)} />) } else if (item.type === 'color') { diff --git a/src/menu/components/chart/antv-pie/chartcompile/formconfig.jsx b/src/menu/components/chart/antv-pie/chartcompile/formconfig.jsx index d6bb257..c68c97d 100644 --- a/src/menu/components/chart/antv-pie/chartcompile/formconfig.jsx +++ b/src/menu/components/chart/antv-pie/chartcompile/formconfig.jsx @@ -46,24 +46,24 @@ return [ { type: 'text', - key: 'title', + field: 'title', label: '鏍囬', - initVal: card.title, + initval: card.title, required: false }, { type: 'text', - key: 'name', + field: 'name', label: '缁勪欢鍚嶇О', - initVal: card.name, + initval: card.name, tooltip: '鐢ㄤ簬缁勪欢闂寸殑鍖哄垎銆�', required: true }, { type: 'number', - key: 'width', + field: 'width', label: '瀹藉害', - initVal: card.width, + initval: card.width, tooltip: '鏍呮牸甯冨眬锛屾瘡琛岀瓑鍒嗕负24鍒椼��', min: 1, max: 24, @@ -72,75 +72,67 @@ }, { type: 'styleInput', - key: 'height', + field: 'height', label: '鍥捐〃楂樺害', - initVal: card.height, + initval: card.height, tooltip: '鍥捐〃缁樺浘鍖哄煙鐨勯珮搴︼紝涓嶅寘鎷爣棰樺強鍐呭杈硅窛銆�', required: true, options: ['px', 'vh', 'vw'] }, { - type: 'cascader', - key: 'linkmenu', + type: isApp ? 'select' : 'cascader', + field: 'linkmenu', label: '鍏宠仈鑿滃崟', - initVal: card.linkmenu || [], - tooltip: '鍙屽嚮楗煎浘锛屼細鎵撳紑鍏宠仈鐨勮彍鍗曘��', + initval: card.linkmenu || (isApp ? '' : []), + tooltip: '鐐瑰嚮楗煎浘锛屼細鎵撳紑鍏宠仈鐨勮彍鍗曘��', required: false, - forbid: isApp, - options: menulist - }, - { - type: 'select', - key: 'linkmenu', - label: '鍏宠仈鑿滃崟', - initVal: card.linkmenu || '', - tooltip: '鍙屽嚮楗煎浘锛屼細鎵撳紑鍏宠仈鐨勮彍鍗曘��', - required: false, - forbid: !isApp, - options: menulist - }, - { - type: 'radio', - key: 'open', - label: '鎵撳紑鏂瑰紡', - initVal: card.open || 'blank', - required: false, - forbid: !isApp, - options: [ - { value: 'blank', text: '鏂扮獥鍙�' }, - { value: 'self', text: '褰撳墠绐楀彛' } + forbid: appType === 'mob', + options: menulist, + controlFields: [ + {field: 'open', notNull: true }, ] }, { type: 'radio', - key: 'permission', + field: 'open', + label: '鎵撳紑鏂瑰紡', + initval: card.open || 'blank', + required: false, + forbid: appType !== 'pc', + options: [ + { value: 'blank', label: '鏂扮獥鍙�' }, + { value: 'self', label: '褰撳墠绐楀彛' } + ] + }, + { + type: 'radio', + field: 'permission', label: '鏉冮檺楠岃瘉', - initVal: card.permission || 'false', + initval: card.permission || 'false', required: false, options: [ - {value: 'true', text: '鍚敤'}, - {value: 'false', text: '绂佺敤'}, + {value: 'true', label: '鍚敤'}, + {value: 'false', label: '绂佺敤'}, ], forbid: !appType || ispop || isprint }, { type: 'radio', - key: 'cacheLocal', + field: 'cacheLocal', label: '鏈湴缂撳瓨', - initVal: card.cacheLocal || 'true', + initval: card.cacheLocal || 'true', required: false, options: [ - {value: 'true', text: '缁ф壙鑿滃崟'}, - {value: 'false', text: '绂佺敤'}, + {value: 'true', label: '缁ф壙鑿滃崟'}, + {value: 'false', label: '绂佺敤'}, ], forbid: ispop || isprint }, { - type: 'select', - key: 'blacklist', + type: 'multiselect', + field: 'blacklist', label: '榛戝悕鍗�', - initVal: card.blacklist || [], - multi: true, + initval: card.blacklist || [], required: false, options: roleList, forbid: !!appType || isprint @@ -153,55 +145,58 @@ * @param {Array} columns // 鏄剧ず鍒� */ export function getOptionForm (card, columns) { - let appType = sessionStorage.getItem('appType') + // let appType = sessionStorage.getItem('appType') let xfields = columns.filter(item => /^Nvarchar/ig.test(item.datatype)) let yfields = columns.filter(item => /^(Int|Decimal)/ig.test(item.datatype)) return [ { type: 'radio', - key: 'shape', + field: 'shape', label: '褰㈢姸', - initVal: card.shape || 'pie', + initval: card.shape || 'pie', required: false, options: [ - { value: 'pie', text: '楗煎浘' }, - { value: 'ring', text: '鐜浘' }, - { value: 'nest', text: '宓屽' }, - { value: 'nightingale', text: '鍗椾竵鏍煎皵鍥�' } + { value: 'pie', label: '楗煎浘' }, + { value: 'ring', label: '鐜浘' }, + { value: 'nest', label: '宓屽' } + ], + controlFields: [ + {field: 'type', values: ['nest']}, + {field: 'legend', values: ['pie', 'ring']}, + {field: 'innerRadius', values: ['nest', 'ring']}, ] }, { type: 'select', - key: 'Xaxis', + field: 'Xaxis', label: '鍚嶇О', - initVal: card.Xaxis || '', + initval: card.Xaxis || '', required: true, options: xfields }, { type: 'select', - key: 'Yaxis', + field: 'Yaxis', label: '鍊�', - initVal: card.Yaxis || '', + initval: card.Yaxis || '', required: true, options: yfields }, { type: 'select', - key: 'type', + field: 'type', label: '绫诲瀷', - initVal: card.type || '', + initval: card.type || '', tooltip: '鍐呯幆鐨勫垎绫诲瓧娈点��', required: true, options: xfields, - hidden: card.shape !== 'nest', }, { type: 'select', - key: 'legend', + field: 'legend', label: '鍥句緥浣嶇疆', - initVal: card.legend || 'bottom', + initval: card.legend || 'bottom', required: false, options: [ { field: 'bottom', label: '涓�' }, @@ -218,13 +213,12 @@ { field: 'left-bottom', label: '宸︿笅' }, { field: 'hidden', label: '闅愯棌' } ], - hidden: card.shape === 'nest', }, { type: 'number', - key: 'radius', + field: 'radius', label: '澶栫幆', - initVal: card.radius || 75, + initval: card.radius || 75, tooltip: '鍥惧舰鎵�鍗犲尯鍩熺殑鐧惧垎鐜囥��', min: 30, max: 100, @@ -233,134 +227,137 @@ }, { type: 'number', - key: 'innerRadius', + field: 'innerRadius', label: '鍐呯幆', - initVal: card.innerRadius || 0, + initval: card.innerRadius || 0, tooltip: '鍐呴儴绌虹櫧鍖哄煙鍗犲浘褰㈢殑鐧惧垎鐜囥��', min: 0, max: 90, decimal: 0, - hidden: !card.shape || card.shape === 'pie', required: true }, { type: 'radio', - key: 'tooltip', + field: 'tooltip', label: '鎮诞鎻愮ず', - initVal: card.tooltip || 'true', + initval: card.tooltip || 'true', required: false, options: [{ value: 'true', - text: '鏄剧ず' + label: '鏄剧ず' }, { value: 'false', - text: '闅愯棌' + label: '闅愯棌' }] }, { type: 'radio', - key: 'show', + field: 'show', label: '鏍煎紡鍖�', - initVal: card.show || 'value', + initval: card.show || 'value', required: false, options: [{ value: 'value', - text: '鏃�' + label: '鏃�' }, { value: 'percent', - text: '鐧惧垎姣�' + label: '鐧惧垎姣�' }] }, { type: 'radio', - key: 'label', + field: 'label', label: '鏍囨敞', - initVal: card.label || 'false', + initval: card.label || 'false', required: false, options: [{ value: 'false', - text: '闅愯棌' + label: '闅愯棌' }, { value: 'inner', - text: '鍐呬晶' - }, { - value: 'outer', - text: '铚樿洓' + label: '鍐呬晶' }, { value: 'normal', - text: '甯歌' - }], - }, { - type: 'radio', - key: 'download', - label: '瀵煎嚭鍥剧墖', - initVal: card.download || 'forbid', - required: false, - forbid: appType === 'mob', - options: [{ - value: 'forbid', - text: '绂佺敤' + label: '澶栦晶' }, { - value: 'enable', - text: '鍚敤' - }] + value: 'outer', + label: '铚樿洓' + }], + // }, { + // type: 'radio', + // field: 'download', + // label: '瀵煎嚭鍥剧墖', + // initval: card.download || 'forbid', + // required: false, + // forbid: appType === 'mob', + // options: [{ + // value: 'forbid', + // label: '绂佺敤' + // }, { + // value: 'enable', + // label: '鍚敤' + // }] }, { type: 'radio', - key: 'empty', + field: 'empty', label: '绌哄�奸殣钘�', - initVal: card.empty || 'show', + initval: card.empty || 'show', tooltip: '褰撴煡璇㈡暟鎹负绌烘椂锛岄殣钘忚缁勪欢銆�', required: false, options: [ - {value: 'show', text: '鍚�'}, - {value: 'hidden', text: '鏄�'}, + {value: 'show', label: '鍚�'}, + {value: 'hidden', label: '鏄�'}, ], }, { type: 'number', - key: 'splitLine', + field: 'splitLine', label: '鍒嗛殧绾�', - initVal: card.splitLine || '', + initval: card.splitLine || '', tooltip: '鍒嗛殧绾跨殑瀹藉害銆�', min: 0, max: 20, decimal: 0, - required: false - }, { - type: 'color', - key: 'splitColor', - label: '鍒嗛殧鑹�', - initVal: card.splitColor || '#ffffff', - tooltip: '鍒嗛殧绾跨殑棰滆壊锛屽瓨鍦ㄥ垎闅旂嚎鏃舵湁鏁堛��', - required: false - }, { - type: 'color', - key: 'color', - label: '鑹茬郴', - initVal: card.color || 'rgba(0, 0, 0, 0.85)', - tooltip: '鍧愭爣杞村強绀轰緥绛夋彁绀烘枃瀛椾娇鐢ㄧ殑棰滆壊銆�', - required: false - }, { - type: 'select', - key: 'interaction', - label: '浜や簰鏁堟灉', - initVal: card.interaction || [], - multi: true, required: false, - forbid: appType === 'mob', - options: [ - { value: 'element-active', label: '鍏冪礌鑱氱劍' }, - { value: 'element-selected', label: '鍏冪礌閫変腑锛堝閫夛級' }, - { value: 'element-single-selected', label: '鍏冪礌閫変腑锛堝崟閫夛級' }, - // { value: 'active-region', label: '鑳屾櫙妗�' }, - // { value: 'view-zoom', label: '瑙嗗浘缂╂斁' }, - { value: 'element-highlight', label: '鍏冪礌楂樹寒' }, - // { value: 'element-highlight-by-color', label: '鍚岃壊鍏冪礌楂樹寒' }, - // { value: 'element-highlight-by-x', label: '鍚孹杞村厓绱犻珮浜�' }, - { value: 'legend-filter', label: '鍥句緥杩囨护' }, - { value: 'legend-active', label: '鍥句緥鑱氱劍' }, - { value: 'legend-highlight', label: '鍥句緥楂樹寒' }, - // { value: 'brush', label: '閫夋杩囨护' }, + controlFields: [ + {field: 'splitColor', notNull: true} ] + }, { + type: 'color', + field: 'splitColor', + label: '鍒嗛殧鑹�', + initval: card.splitColor || '#ffffff', + tooltip: '鍒嗛殧绾跨殑棰滆壊銆�', + allowClear: true, + required: false + // }, { + // type: 'color', + // field: 'color', + // label: '鑹茬郴', + // initval: card.color || 'rgba(0, 0, 0, 0.85)', + // tooltip: '绀轰緥绛夋彁绀烘枃瀛椾娇鐢ㄧ殑棰滆壊銆�', + // required: false + // } , { + // type: 'select', + // field: 'interaction', + // label: '浜や簰鏁堟灉', + // initval: card.interaction || [], + // multi: true, + // required: false, + // forbid: appType === 'mob', + // options: [ + // { value: 'element-active', label: '鍏冪礌鑱氱劍' }, + // { value: 'element-selected', label: '鍏冪礌閫変腑锛堝閫夛級' }, + // { value: 'element-single-selected', label: '鍏冪礌閫変腑锛堝崟閫夛級' }, + // // { value: 'active-region', label: '鑳屾櫙妗�' }, + // // { value: 'view-zoom', label: '瑙嗗浘缂╂斁' }, + // { value: 'element-highlight', label: '鍏冪礌楂樹寒' }, + // // { value: 'element-highlight-by-color', label: '鍚岃壊鍏冪礌楂樹寒' }, + // // { value: 'element-highlight-by-x', label: '鍚孹杞村厓绱犻珮浜�' }, + // { value: 'legend-filter', label: '鍥句緥杩囨护' }, + // { value: 'legend-active', label: '鍥句緥鑱氱劍' }, + // { value: 'legend-highlight', label: '鍥句緥楂樹寒' }, + // // { value: 'brush', label: '閫夋杩囨护' }, + // ] } ] } diff --git a/src/menu/components/chart/antv-pie/chartcompile/index.jsx b/src/menu/components/chart/antv-pie/chartcompile/index.jsx index 2d6fdc4..dbec1e0 100644 --- a/src/menu/components/chart/antv-pie/chartcompile/index.jsx +++ b/src/menu/components/chart/antv-pie/chartcompile/index.jsx @@ -1,21 +1,20 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { fromJS } from 'immutable' -import { Modal, Form, Row, Col, Select, Radio, Tooltip, Input, notification, InputNumber, Tabs, Button } from 'antd' -import { QuestionCircleOutlined, EditOutlined } from '@ant-design/icons' +import { Modal, notification, Tabs, Button } from 'antd' +import { EditOutlined } from '@ant-design/icons' import Utils from '@/utils/utils.js' import { getBaseForm, getOptionForm } from './formconfig' import asyncComponent from '@/utils/asyncComponent' -import ColorSketch from '@/mob/colorsketch' import './index.scss' const { TabPane } = Tabs const EditTable = asyncComponent(() => import('@/templates/zshare/editTable')) -const NormalForm = asyncComponent(() => import('@/menu/components/share/normalform')) +const NormalForm = asyncComponent(() => import('@/components/normalform/modalform')) -class LineChartDrawerForm extends Component { +class PieChartDrawerForm extends Component { static propTpyes = { plot: PropTypes.object, config: PropTypes.object, @@ -80,145 +79,9 @@ }, () => { if (val === 'ring') { this.props.form.setFieldsValue({innerRadius: 50}) - } else if (val === 'nightingale') { - this.props.form.setFieldsValue({innerRadius: 0}) } }) } - } - - getFields() { - const { formlist } = this.state - const { getFieldDecorator } = this.props.form - const fields = [] - - if (!formlist) { - return fields - } - - formlist.forEach((item, index) => { - if (item.hidden || item.forbid) return - - if (item.type === 'text') { - fields.push( - <Col span={12} key={index}> - <Form.Item label={item.tooltip ? - <Tooltip placement="topLeft" title={item.tooltip}> - <QuestionCircleOutlined className="mk-form-tip" /> - {item.label} - </Tooltip> : item.label - }> - {getFieldDecorator(item.key, { - initialValue: item.initVal, - rules: [ - { - required: !!item.required, - message: '璇疯緭鍏�' + item.label + '!' - } - ] - })(<Input placeholder="" autoComplete="off" disabled={item.readonly} onPressEnter={this.onSubmit}/>)} - </Form.Item> - </Col> - ) - } else if (item.type === 'number') { - fields.push( - <Col span={12} key={index}> - <Form.Item label={item.tooltip ? - <Tooltip placement="topLeft" title={item.tooltip}> - <QuestionCircleOutlined className="mk-form-tip" /> - {item.label} - </Tooltip> : item.label - }> - {getFieldDecorator(item.key, { - initialValue: item.initVal, - rules: [ - { - required: !!item.required, - message: '璇疯緭鍏�' + item.label + '!' - } - ] - })(<InputNumber min={item.min} max={item.max} precision={item.decimal} onPressEnter={this.onSubmit}/>)} - </Form.Item> - </Col> - ) - } else if (item.type === 'select') { // 涓嬫媺 - fields.push( - <Col span={12} key={index}> - <Form.Item label={item.tooltip ? - <Tooltip placement="topLeft" title={item.tooltip}> - <QuestionCircleOutlined className="mk-form-tip" /> - {item.label} - </Tooltip> : item.label - }> - {getFieldDecorator(item.key, { - initialValue: item.initVal, - rules: [ - { - required: !!item.required, - message: '璇烽�夋嫨' + item.label + '!' - } - ] - })( - <Select mode={item.multi ? 'multiple' : ''}> - {item.options.map((option, index) => - <Select.Option key={index} value={option.field || option.value}> - {option.label} - </Select.Option> - )} - </Select> - )} - </Form.Item> - </Col> - ) - } else if (item.type === 'radio') { - fields.push( - <Col span={12} key={index}> - <Form.Item label={item.tooltip ? - <Tooltip placement="topLeft" title={item.tooltip}> - <QuestionCircleOutlined className="mk-form-tip" /> - {item.label} - </Tooltip> : item.label - }> - {getFieldDecorator(item.key, { - initialValue: item.initVal, - rules: [ - { - required: !!item.required, - message: '璇烽�夋嫨' + item.label + '!' - } - ] - })( - <Radio.Group style={{whiteSpace: 'nowrap'}} disabled={item.readonly} onChange={(e) => this.radioChange(e, item.key)}> - {item.options.map(option => { - return ( - <Radio key={option.value} value={option.value}>{option.text}</Radio> - ) - })} - </Radio.Group> - )} - </Form.Item> - </Col> - ) - } else if (item.type === 'color') { - fields.push( - <Col span={12} key={index}> - <Form.Item label={item.tooltip ? - <Tooltip placement="topLeft" title={item.tooltip}> - <QuestionCircleOutlined className="mk-form-tip" /> - {item.label} - </Tooltip> : item.label - }> - {getFieldDecorator(item.key, { - initialValue: item.initVal - })( - <ColorSketch /> - )} - </Form.Item> - </Col> - ) - } - }) - return fields } onSubmit = () => { @@ -226,17 +89,15 @@ const { plot, view } = this.state if (view === 'normal') { - this.props.form.validateFieldsAndScroll((err, values) => { - if (!err) { - let _plot = {...plot, ...values} - - this.setState({ - plot: _plot, - visible: false - }) - - this.props.plotchange({...config, plot: _plot}) - } + this.normalRef.handleConfirm().then(values => { + let _plot = {...plot, ...values} + + this.setState({ + plot: _plot, + visible: false + }) + + this.props.plotchange({...config, plot: _plot}) }) } else if (view === 'base') { this.baseRef.handleConfirm().then(res => { @@ -262,15 +123,13 @@ const { plot, view } = this.state if (view === 'normal') { - this.props.form.validateFieldsAndScroll((err, values) => { - if (!err) { - let _plot = {...plot, ...values} + this.normalRef.handleConfirm().then(values => { + let _plot = {...plot, ...values} - this.setState({ - plot: _plot, - view: tab - }) - } + this.setState({ + plot: _plot, + view: tab + }) }) } else if (view === 'base') { this.baseRef.handleConfirm().then(res => { @@ -321,17 +180,7 @@ render() { const { config } = this.props - const { visible, plot, colorColumns, view, baseFormlist } = this.state - const formItemLayout = { - labelCol: { - xs: { span: 24 }, - sm: { span: 6 } - }, - wrapperCol: { - xs: { span: 24 }, - sm: { span: 18 } - } - } + const { visible, plot, colorColumns, formlist, view, baseFormlist } = this.state return ( <div className="line-chart-drawer-form"> @@ -339,7 +188,7 @@ <Modal wrapClassName="mk-pop-modal" visible={visible} - width={850} + width={900} maskClosable={false} onOk={this.onSubmit} onCancel={() => { this.setState({ visible: false }) }} @@ -351,9 +200,7 @@ <NormalForm formlist={baseFormlist} inputSubmit={this.onSubmit} wrappedComponentRef={(inst) => this.baseRef = inst}/> </TabPane> <TabPane tab="鍥捐〃璁剧疆" key="normal"> - <Form {...formItemLayout}> - <Row gutter={16}>{this.getFields()}</Row> - </Form> + <NormalForm formlist={formlist} inputSubmit={this.onSubmit} wrappedComponentRef={(inst) => this.normalRef = inst}/> </TabPane> {plot ? <TabPane tab="棰滆壊璁剧疆" key="color"> <div> @@ -362,11 +209,10 @@ </div> </TabPane> : null} </Tabs> - </Modal> </div> ); } } -export default Form.create()(LineChartDrawerForm) \ No newline at end of file +export default PieChartDrawerForm \ No newline at end of file diff --git a/src/menu/components/chart/antv-pie/chartcompile/index.scss b/src/menu/components/chart/antv-pie/chartcompile/index.scss index 58ad288..de0c5fa 100644 --- a/src/menu/components/chart/antv-pie/chartcompile/index.scss +++ b/src/menu/components/chart/antv-pie/chartcompile/index.scss @@ -5,11 +5,6 @@ } } .menu-chart-edit-box { - .color-sketch-block { - position: relative; - top: 5px; - width: 240px; - } .color-add { float: right; margin-bottom: 10px; diff --git a/src/menu/components/chart/antv-pie/index.jsx b/src/menu/components/chart/antv-pie/index.jsx index f5a70b1..1d531fd 100644 --- a/src/menu/components/chart/antv-pie/index.jsx +++ b/src/menu/components/chart/antv-pie/index.jsx @@ -417,7 +417,7 @@ height: getHeight(plot.height) }) - if (plot.shape !== 'nightingale' && plot.show !== 'value') { + if (plot.show !== 'value') { dv.transform({ type: 'percent', field: Y_axis, @@ -436,29 +436,13 @@ } chart.data(dv.rows) - if (plot.shape === 'nightingale') { - chart.coordinate('polar', { - innerRadius: plot.innerRadius ? (plot.innerRadius / 100) : 0, - radius: plot.radius ? (plot.radius / 100) : 0.85, - }) - } else { - chart.coordinate('theta', { - innerRadius: plot.shape !== 'pie' && plot.innerRadius ? (plot.innerRadius / 100) : 0, - radius: plot.radius ? (plot.radius / 100) : 0.85, - }) - } + chart.coordinate('theta', { + innerRadius: plot.shape !== 'pie' && plot.innerRadius ? (plot.innerRadius / 100) : 0, + radius: plot.radius ? (plot.radius / 100) : 0.85, + }) if (!plot.legend || plot.legend === 'hidden') { chart.legend(false) - } else if (plot.shape === 'nightingale') { - chart.legend(X_axis, { - position: plot.legend, - itemName: { - style: { - fill: color, - } - } - }) } else { chart.legend({ position: plot.legend, @@ -480,100 +464,73 @@ } // 楗煎浘鎴栫幆鍥� - if (plot.shape !== 'nightingale') { - let _chart = chart - .interval() - .adjust('stack') - .position(Y_axis) - .color(X_axis) - .tooltip(`${X_axis}*${Y_axis}`, (name, value) => { - if (plot.show !== 'value') { - value = (value * 100).toFixed(2) + '%' - } - return { - name: name, - value: value + let _chart = chart + .interval() + .adjust('stack') + .position(Y_axis) + .color(X_axis) + .tooltip(`${X_axis}*${Y_axis}`, (name, value) => { + if (plot.show !== 'value') { + value = (value * 100).toFixed(2) + '%' + } + return { + name: name, + value: value + } + }) + + if (plot.splitLine) { + _chart.style({ + lineWidth: plot.splitLine, + stroke: plot.splitColor, + }) + } + + if (plot.label !== 'false') { + if (plot.label === 'inner') { + _chart.label(Y_axis, { + offset: -30, + content: (data) => { + let _val = '' + if (plot.show !== 'value') { + _val = `${(data[Y_axis] * 100).toFixed(2)}%` + } else { + _val = `${data[Y_axis]}` + } + return _val + }, + style: { + textAlign: 'center', + fontSize: 16, + shadowBlur: 2, + shadowColor: 'rgba(0, 0, 0, .45)', + fill: '#fff', } }) + } else { + _chart.label(Y_axis, { + layout: { type: plot.label === 'outer' ? 'pie-spider' : 'fixed-overlap' }, + labelHeight: 20, + content: (data) => { + let _val = '' + if (plot.show !== 'value') { + _val = `${(data[Y_axis] * 100).toFixed(2)}%` + } else { + _val = `${data[Y_axis]}` + } - if (plot.splitLine) { - _chart.style({ - lineWidth: plot.splitLine, - stroke: plot.splitColor, + return `${data[X_axis]}: ${_val}` + }, + labelLine: { + style: { + lineWidth: 0.5, + }, + }, + style: { + fill: color + } }) } - - if (plot.label !== 'false') { - if (plot.label === 'inner') { - _chart.label(Y_axis, { - offset: -30, - content: (data) => { - let _val = '' - if (plot.show !== 'value') { - _val = `${(data[Y_axis] * 100).toFixed(2)}%` - } else { - _val = `${data[Y_axis]}` - } - return _val - }, - style: { - textAlign: 'center', - fontSize: 16, - shadowBlur: 2, - shadowColor: 'rgba(0, 0, 0, .45)', - fill: '#fff', - } - }) - } else { - _chart.label(Y_axis, { - layout: { type: plot.label === 'outer' ? 'pie-spider' : 'fixed-overlap' }, - labelHeight: 20, - content: (data) => { - let _val = '' - if (plot.show !== 'value') { - _val = `${(data[Y_axis] * 100).toFixed(2)}%` - } else { - _val = `${data[Y_axis]}` - } - - return `${data[X_axis]}: ${_val}` - }, - labelLine: { - style: { - lineWidth: 0.5, - }, - }, - style: { - fill: color - } - }) - } - } - } else { - chart.axis(false) - let _chart = chart - .interval() - .position(`${X_axis}*${Y_axis}`) - .color(X_axis) - - if (plot.label !== 'false') { - let _label = {} - if (plot.label === 'inner') { - _label.offset = -15 - } else { - _label.style = { - fill: color - } - } - - _chart.label(X_axis, _label) - } - if (plot.splitLine) { - _chart.style({ - lineWidth: plot.splitLine, - stroke: plot.splitColor, - }) - } } if (plot.interaction && plot.interaction.length) { diff --git a/src/menu/components/chart/antv-scatter/chartcompile/formconfig.jsx b/src/menu/components/chart/antv-scatter/chartcompile/formconfig.jsx index f8eaadf..5734ab3 100644 --- a/src/menu/components/chart/antv-scatter/chartcompile/formconfig.jsx +++ b/src/menu/components/chart/antv-scatter/chartcompile/formconfig.jsx @@ -200,28 +200,29 @@ initVal: card.color || 'rgba(0, 0, 0, 0.65)', tooltip: '鍧愭爣杞存彁绀烘枃瀛楀強绀轰緥鐨勯鑹层��', required: false - }, { - type: 'select', - key: 'interaction', - label: '浜や簰鏁堟灉', - initVal: card.interaction || [], - multi: true, - required: false, - forbid: appType === 'mob', - options: [ - { value: 'element-active', label: '鍏冪礌鑱氱劍' }, - { value: 'element-selected', label: '鍏冪礌閫変腑锛堝閫夛級' }, - { value: 'element-single-selected', label: '鍏冪礌閫変腑锛堝崟閫夛級' }, - // { value: 'active-region', label: '鑳屾櫙妗�' }, - { value: 'view-zoom', label: '瑙嗗浘缂╂斁' }, - { value: 'element-highlight', label: '鍏冪礌楂樹寒' }, - { value: 'element-highlight-by-color', label: '鍚岃壊鍏冪礌楂樹寒' }, - { value: 'element-highlight-by-x', label: '鍚孹杞村厓绱犻珮浜�' }, - { value: 'legend-filter', label: '鍥句緥杩囨护' }, - { value: 'legend-active', label: '鍥句緥鑱氱劍' }, - { value: 'legend-highlight', label: '鍥句緥楂樹寒' }, - { value: 'brush', label: '閫夋杩囨护' }, - ] } + // , { + // type: 'select', + // key: 'interaction', + // label: '浜や簰鏁堟灉', + // initVal: card.interaction || [], + // multi: true, + // required: false, + // forbid: appType === 'mob', + // options: [ + // { value: 'element-active', label: '鍏冪礌鑱氱劍' }, + // { value: 'element-selected', label: '鍏冪礌閫変腑锛堝閫夛級' }, + // { value: 'element-single-selected', label: '鍏冪礌閫変腑锛堝崟閫夛級' }, + // // { value: 'active-region', label: '鑳屾櫙妗�' }, + // { value: 'view-zoom', label: '瑙嗗浘缂╂斁' }, + // { value: 'element-highlight', label: '鍏冪礌楂樹寒' }, + // { value: 'element-highlight-by-color', label: '鍚岃壊鍏冪礌楂樹寒' }, + // { value: 'element-highlight-by-x', label: '鍚孹杞村厓绱犻珮浜�' }, + // { value: 'legend-filter', label: '鍥句緥杩囨护' }, + // { value: 'legend-active', label: '鍥句緥鑱氱劍' }, + // { value: 'legend-highlight', label: '鍥句緥楂樹寒' }, + // { value: 'brush', label: '閫夋杩囨护' }, + // ] + // } ] } diff --git a/src/menu/modulesource/option.jsx b/src/menu/modulesource/option.jsx index ab60da4..1607a5a 100644 --- a/src/menu/modulesource/option.jsx +++ b/src/menu/modulesource/option.jsx @@ -12,7 +12,6 @@ import SandBox from '@/assets/mobimg/sandbox.png' import Pie1 from '@/assets/mobimg/ring.png' import Pie3 from '@/assets/mobimg/nest.png' -import Pie2 from '@/assets/mobimg/nightingale.png' import Mainsearch from '@/assets/mobimg/mainsearch.png' import Carousel from '@/assets/mobimg/carousel.png' import Carousel1 from '@/assets/mobimg/carousel1.png' @@ -59,7 +58,6 @@ { type: 'menu', url: Pie, component: 'pie', subtype: 'pie', title: '楗煎浘', width: 12 }, { type: 'menu', url: Pie1, component: 'pie', subtype: 'ring', title: '鐜浘', width: 12 }, { type: 'menu', url: Pie3, component: 'pie', subtype: 'nest', title: '宓屽楗煎浘', width: 12 }, - { type: 'menu', url: Pie2, component: 'pie', subtype: 'nightingale', title: '鍗椾竵鏍煎皵鍥�', width: 12 }, { type: 'menu', url: dashboard, component: 'dashboard', subtype: 'dashboard', title: '浠〃鐩�', width: 12 }, { type: 'menu', url: ratioboard, component: 'dashboard', subtype: 'ratioboard', title: '鍗犳瘮鍥�', width: 12 }, { type: 'menu', url: scatter, component: 'scatter', subtype: 'scatter', title: '鏁g偣鍥�', width: 24 }, diff --git a/src/mob/modulesource/option.jsx b/src/mob/modulesource/option.jsx index f4b8529..c5c6c61 100644 --- a/src/mob/modulesource/option.jsx +++ b/src/mob/modulesource/option.jsx @@ -12,7 +12,6 @@ import Editor from '@/assets/mobimg/editor.png' import SandBox from '@/assets/mobimg/sandbox.png' import Pie1 from '@/assets/mobimg/ring.png' -import Pie2 from '@/assets/mobimg/nightingale.png' import singlesearch from '@/assets/mobimg/singlesearch.png' import Navbar from '@/assets/mobimg/navbar-mob.png' import Carousel from '@/assets/mobimg/carousel.png' @@ -56,7 +55,6 @@ { type: 'menu', url: bar1, component: 'bar', subtype: 'bar1', title: '鏉″舰鍥�', width: 24 }, { type: 'menu', url: Pie, component: 'pie', subtype: 'pie', title: '楗煎浘', width: 24 }, { type: 'menu', url: Pie1, component: 'pie', subtype: 'ring', title: '鐜浘', width: 24 }, - { type: 'menu', url: Pie2, component: 'pie', subtype: 'nightingale', title: '鍗椾竵鏍煎皵鍥�', width: 24 }, // { type: 'menu', url: dashboard, component: 'dashboard', subtype: 'dashboard', title: '浠〃鐩�', width: 12 }, { type: 'menu', url: scatter, component: 'scatter', subtype: 'scatter', title: '鏁g偣鍥�', width: 24 }, { type: 'menu', url: Editor, component: 'editor', subtype: 'brafteditor', title: '瀵屾枃鏈�', width: 24 }, diff --git a/src/pc/modulesource/option.jsx b/src/pc/modulesource/option.jsx index e5dbf8a..90e2959 100644 --- a/src/pc/modulesource/option.jsx +++ b/src/pc/modulesource/option.jsx @@ -13,7 +13,6 @@ import SandBox from '@/assets/mobimg/sandbox.png' import Pie1 from '@/assets/mobimg/ring.png' import Pie3 from '@/assets/mobimg/nest.png' -import Pie2 from '@/assets/mobimg/nightingale.png' import Mainsearch from '@/assets/mobimg/mainsearch.png' import Navbar from '@/assets/mobimg/navbar.png' import Carousel from '@/assets/mobimg/carousel.png' @@ -54,7 +53,6 @@ { type: 'menu', url: Pie, component: 'pie', subtype: 'pie', title: '楗煎浘', width: 12 }, { type: 'menu', url: Pie1, component: 'pie', subtype: 'ring', title: '鐜浘', width: 12 }, { type: 'menu', url: Pie3, component: 'pie', subtype: 'nest', title: '宓屽楗煎浘', width: 12 }, - { type: 'menu', url: Pie2, component: 'pie', subtype: 'nightingale', title: '鍗椾竵鏍煎皵鍥�', width: 12 }, { type: 'menu', url: dashboard, component: 'dashboard', subtype: 'dashboard', title: '浠〃鐩�', width: 12 }, { type: 'menu', url: ratioboard, component: 'dashboard', subtype: 'ratioboard', title: '鍗犳瘮鍥�', width: 12 }, { type: 'menu', url: scatter, component: 'scatter', subtype: 'scatter', title: '鏁g偣鍥�', width: 24 }, diff --git a/src/tabviews/custom/components/chart/antv-pie/index.jsx b/src/tabviews/custom/components/chart/antv-pie/index.jsx index 2602e4d..4b9a3d2 100644 --- a/src/tabviews/custom/components/chart/antv-pie/index.jsx +++ b/src/tabviews/custom/components/chart/antv-pie/index.jsx @@ -676,7 +676,7 @@ height: plot.height }) - if (plot.shape !== 'nightingale' && plot.show !== 'value') { + if (plot.show !== 'value') { dv.transform({ type: 'percent', field: Y_axis, @@ -696,27 +696,13 @@ chart.data(dv.rows) - if (plot.shape === 'nightingale') { - chart.coordinate('polar', { - innerRadius: plot.innerRadius ? (plot.innerRadius / 100) : 0, - radius: plot.radius ? (plot.radius / 100) : 0.75, - }) - } else { - chart.coordinate('theta', { - innerRadius: plot.shape !== 'pie' && plot.innerRadius ? (plot.innerRadius / 100) : 0, - radius: plot.radius ? (plot.radius / 100) : 0.75, - }) - } + chart.coordinate('theta', { + innerRadius: plot.shape !== 'pie' && plot.innerRadius ? (plot.innerRadius / 100) : 0, + radius: plot.radius ? (plot.radius / 100) : 0.75, + }) if (!plot.legend || plot.legend === 'hidden') { chart.legend(false) - } else if (plot.shape === 'nightingale') { - chart.legend(X_axis, { - position: plot.legend, - itemName: { - style: { fill: color } - } - }) } else { chart.legend({ position: plot.legend, @@ -746,125 +732,84 @@ }) } - if (plot.shape !== 'nightingale') { - let _chart = chart - .interval() - .adjust('stack') - .position(Y_axis) - .tooltip(`${X_axis}*${Y_axis}`, (name, value) => { - if (plot.show !== 'value') { - value = (value * 100).toFixed(2) + '%' - } - return { - name: name, - value: value - } - }) - - if (plot.splitLine) { - _chart.style({ - lineWidth: plot.splitLine, - stroke: plot.splitColor, - }) - } - if (plot.colors && plot.colors.length > 0) { - let limit = chartColors.length - _chart.color(X_axis, (type) => { - if (colors.has(type)) { - return colors.get(type) - } else { - let _c = chartColors[colorIndex % limit] - colors.set(type, _c) - colorIndex++ - return _c - } - }) - } else { - _chart.color(X_axis) - } - if (plot.label !== 'false') { - if (plot.label === 'inner') { - _chart.label(Y_axis, { - offset: -30, - content: (data) => { - let _val = '' - if (plot.show !== 'value') { - _val = `${(data[Y_axis] * 100).toFixed(2)}%` - } else { - _val = `${data[Y_axis]}` - } - return _val - }, - style: { - textAlign: 'center', - fontSize: 16, - shadowBlur: 2, - shadowColor: 'rgba(0, 0, 0, .45)', - fill: '#fff', - } - }) - } else { - _chart.label(Y_axis, { - layout: { type: plot.label === 'outer' ? 'pie-spider' : 'fixed-overlap' }, - labelHeight: 20, - content: (data) => { - let _val = '' - if (plot.show !== 'value') { - _val = `${(data[Y_axis] * 100).toFixed(2)}%` - } else { - _val = `${data[Y_axis]}` - } - - return `${data[X_axis]}: ${_val}` - }, - labelLine: { - style: { - lineWidth: 0.5, - }, - }, - style: { - fill: color - } - }) + let _chart = chart + .interval() + .adjust('stack') + .position(Y_axis) + .tooltip(`${X_axis}*${Y_axis}`, (name, value) => { + if (plot.show !== 'value') { + value = (value * 100).toFixed(2) + '%' } - } - } else { - chart.axis(false) - let _chart = chart - .interval() - .position(`${X_axis}*${Y_axis}`) + return { + name: name, + value: value + } + }) - if (plot.colors && plot.colors.length > 0) { - let limit = chartColors.length - _chart.color(X_axis, (type) => { - if (colors.has(type)) { - return colors.get(type) - } else { - let _c = chartColors[colorIndex % limit] - colors.set(type, _c) - colorIndex++ - return _c + if (plot.splitLine) { + _chart.style({ + lineWidth: plot.splitLine, + stroke: plot.splitColor, + }) + } + if (plot.colors && plot.colors.length > 0) { + let limit = chartColors.length + _chart.color(X_axis, (type) => { + if (colors.has(type)) { + return colors.get(type) + } else { + let _c = chartColors[colorIndex % limit] + colors.set(type, _c) + colorIndex++ + return _c + } + }) + } else { + _chart.color(X_axis) + } + if (plot.label !== 'false') { + if (plot.label === 'inner') { + _chart.label(Y_axis, { + offset: -30, + content: (data) => { + let _val = '' + if (plot.show !== 'value') { + _val = `${(data[Y_axis] * 100).toFixed(2)}%` + } else { + _val = `${data[Y_axis]}` + } + return _val + }, + style: { + textAlign: 'center', + fontSize: 16, + shadowBlur: 2, + shadowColor: 'rgba(0, 0, 0, .45)', + fill: '#fff', } }) } else { - _chart.color(X_axis) - } - if (plot.label !== 'false') { - let _label = {} - if (plot.label === 'inner') { - _label.offset = -15 - } else { - _label.style = { + _chart.label(Y_axis, { + layout: { type: plot.label === 'outer' ? 'pie-spider' : 'fixed-overlap' }, + labelHeight: 20, + content: (data) => { + let _val = '' + if (plot.show !== 'value') { + _val = `${(data[Y_axis] * 100).toFixed(2)}%` + } else { + _val = `${data[Y_axis]}` + } + + return `${data[X_axis]}: ${_val}` + }, + labelLine: { + style: { + lineWidth: 0.5, + }, + }, + style: { fill: color } - } - - _chart.label(X_axis, _label) - } - if (plot.splitLine) { - _chart.style({ - lineWidth: plot.splitLine, - stroke: plot.splitColor, }) } } -- Gitblit v1.8.0