|
|
@@ -1,8 +1,16 @@
|
|
|
import React from 'react'
|
|
|
-import { Form, Divider, Checkbox } from 'antd'
|
|
|
+import { Form, Divider, Checkbox, Select } from 'antd'
|
|
|
import { connect } from 'dva'
|
|
|
import { deepAssign } from '../../../../utils/baseUtils'
|
|
|
|
|
|
+const formatters = [
|
|
|
+ { value: '{b}', label: '名称' },
|
|
|
+ { value: '{b} {c}', label: '名称、数值' },
|
|
|
+ { value: '{b} {d}%', label: '名称、百分比' },
|
|
|
+ { value: '{c} {d}%', label: '数值、百分比' },
|
|
|
+ { value: '{b} {c}\n{d}%', label: '全部信息' },
|
|
|
+]
|
|
|
+
|
|
|
class PieStyleConfig extends React.Component {
|
|
|
constructor(props) {
|
|
|
super(props);
|
|
|
@@ -39,6 +47,24 @@ class PieStyleConfig extends React.Component {
|
|
|
}}
|
|
|
/>
|
|
|
</Form.Item>
|
|
|
+ {!pieStyle.labelHidden && <Form.Item label='格式' {...formItemLayout}>
|
|
|
+ <Select
|
|
|
+ defaultValue={pieStyle.labelFormatter || '{b}'}
|
|
|
+ onChange={value => {
|
|
|
+ let fields = [{ name: 'styleConfig', value: deepAssign(styleConfig, { pie: { labelFormatter: value } }) }];
|
|
|
+ if(!!chartOption.baseOption) {
|
|
|
+ fields.push({ name: 'chartOption', value: deepAssign(chartOption, { baseOption: { series: { 0: {
|
|
|
+ label: { normal: { formatter: value } }
|
|
|
+ } } } }) });
|
|
|
+ }
|
|
|
+ dispatch({ type: 'chartDesigner/setFields', fields });
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ {formatters.map((f) => (
|
|
|
+ <Select.Option value={f.value} key={f.value}>{f.label}</Select.Option>
|
|
|
+ ))}
|
|
|
+ </Select>
|
|
|
+ </Form.Item>}
|
|
|
</Form>
|
|
|
}
|
|
|
}
|