Unverified 提交 a4b210fb authored 作者: XiaJunjie2020's avatar XiaJunjie2020 提交者: GitHub

Merge pull request #134 from dataease/pr@dev@饼图标签增加引导线选项

feat: 饼图标签增加引导线设置
...@@ -736,7 +736,10 @@ export default { ...@@ -736,7 +736,10 @@ export default {
change_ds: 'Change Dataset', change_ds: 'Change Dataset',
change_ds_tip: 'Tips:Change Dataset will change fields,you need rebuild chart', change_ds_tip: 'Tips:Change Dataset will change fields,you need rebuild chart',
axis_name_color: 'Name Color', axis_name_color: 'Name Color',
axis_name_fontsize: 'Name Fontsize' axis_name_fontsize: 'Name Fontsize',
pie_label_line_show: 'Line',
outside: 'Outside',
center: 'Center'
}, },
dataset: { dataset: {
sheet_warn: 'There are multiple sheet pages, and the first one is extracted by default', sheet_warn: 'There are multiple sheet pages, and the first one is extracted by default',
......
...@@ -778,7 +778,10 @@ export default { ...@@ -778,7 +778,10 @@ export default {
change_ds: '更換數據集', change_ds: '更換數據集',
change_ds_tip: '提示:更換數據集將導致字段發生變化,需重新製作視圖', change_ds_tip: '提示:更換數據集將導致字段發生變化,需重新製作視圖',
axis_name_color: '名稱顏色', axis_name_color: '名稱顏色',
axis_name_fontsize: '名稱字體' axis_name_fontsize: '名稱字體',
pie_label_line_show: '引導線',
outside: '外',
center: '中心'
}, },
dataset: { dataset: {
sheet_warn: '有多個sheet頁面,默認抽取第一個', sheet_warn: '有多個sheet頁面,默認抽取第一個',
......
...@@ -736,7 +736,10 @@ export default { ...@@ -736,7 +736,10 @@ export default {
change_ds: '更换数据集', change_ds: '更换数据集',
change_ds_tip: '提示:更换数据集将导致字段发生变化,需重新制作视图', change_ds_tip: '提示:更换数据集将导致字段发生变化,需重新制作视图',
axis_name_color: '名称颜色', axis_name_color: '名称颜色',
axis_name_fontsize: '名称字体' axis_name_fontsize: '名称字体',
pie_label_line_show: '引导线',
outside: '外',
center: '中心'
}, },
dataset: { dataset: {
sheet_warn: '有多个 Sheet 页,默认抽取第一个', sheet_warn: '有多个 Sheet 页,默认抽取第一个',
......
...@@ -20,7 +20,7 @@ export const DEFAULT_SIZE = { ...@@ -20,7 +20,7 @@ export const DEFAULT_SIZE = {
lineSmooth: false, lineSmooth: false,
lineArea: false, lineArea: false,
pieInnerRadius: 0, pieInnerRadius: 0,
pieOuterRadius: 60, pieOuterRadius: 80,
pieRoseType: 'radius', pieRoseType: 'radius',
pieRoseRadius: 5, pieRoseRadius: 5,
funnelWidth: 80, funnelWidth: 80,
...@@ -45,7 +45,10 @@ export const DEFAULT_LABEL = { ...@@ -45,7 +45,10 @@ export const DEFAULT_LABEL = {
color: '#909399', color: '#909399',
fontSize: '10', fontSize: '10',
formatter: '{c}', formatter: '{c}',
gaugeFormatter: '{value}' gaugeFormatter: '{value}',
labelLine: {
show: true
}
} }
export const DEFAULT_TOOLTIP = { export const DEFAULT_TOOLTIP = {
show: true, show: true,
......
...@@ -29,6 +29,7 @@ export function basePieOption(chart_option, chart) { ...@@ -29,6 +29,7 @@ export function basePieOption(chart_option, chart) {
// label // label
if (customAttr.label) { if (customAttr.label) {
chart_option.series[0].label = customAttr.label chart_option.series[0].label = customAttr.label
chart_option.series[0].labelLine = customAttr.label.labelLine
} }
const valueArr = chart.data.series[0].data const valueArr = chart.data.series[0].data
for (let i = 0; i < valueArr.length; i++) { for (let i = 0; i < valueArr.length; i++) {
......
...@@ -12,6 +12,9 @@ ...@@ -12,6 +12,9 @@
<!-- <el-form-item :label="$t('chart.show')" class="form-item">--> <!-- <el-form-item :label="$t('chart.show')" class="form-item">-->
<!-- <el-checkbox v-model="labelForm.show" @change="changeLabelAttr">{{ $t('chart.show') }}</el-checkbox>--> <!-- <el-checkbox v-model="labelForm.show" @change="changeLabelAttr">{{ $t('chart.show') }}</el-checkbox>-->
<!-- </el-form-item>--> <!-- </el-form-item>-->
<el-form-item :label="$t('chart.pie_label_line_show')" class="form-item">
<el-checkbox v-model="labelForm.labelLine.show" @change="changeLabelAttr">{{ $t('chart.pie_label_line_show') }}</el-checkbox>
</el-form-item>
<el-form-item :label="$t('chart.text_fontsize')" class="form-item"> <el-form-item :label="$t('chart.text_fontsize')" class="form-item">
<el-select v-model="labelForm.fontSize" :placeholder="$t('chart.text_fontsize')" size="mini" @change="changeLabelAttr"> <el-select v-model="labelForm.fontSize" :placeholder="$t('chart.text_fontsize')" size="mini" @change="changeLabelAttr">
<el-option v-for="option in fontSize" :key="option.value" :label="option.name" :value="option.value" /> <el-option v-for="option in fontSize" :key="option.value" :label="option.name" :value="option.value" />
...@@ -21,13 +24,9 @@ ...@@ -21,13 +24,9 @@
<colorPicker v-model="labelForm.color" style="margin-top: 6px;cursor: pointer;z-index: 999;border: solid 1px black" @change="changeLabelAttr" /> <colorPicker v-model="labelForm.color" style="margin-top: 6px;cursor: pointer;z-index: 999;border: solid 1px black" @change="changeLabelAttr" />
</el-form-item> </el-form-item>
<el-form-item :label="$t('chart.label_position')" class="form-item"> <el-form-item :label="$t('chart.label_position')" class="form-item">
<el-radio-group v-model="labelForm.position" size="mini" @change="changeLabelAttr"> <el-select v-model="labelForm.position" :placeholder="$t('chart.label_position')" @change="changeLabelAttr">
<el-radio-button label="inside">{{ $t('chart.inside') }}</el-radio-button> <el-option v-for="option in labelPosition" :key="option.value" :label="option.name" :value="option.value" />
<el-radio-button label="top">{{ $t('chart.text_pos_top') }}</el-radio-button> </el-select>
<el-radio-button label="bottom">{{ $t('chart.text_pos_bottom') }}</el-radio-button>
<el-radio-button label="left">{{ $t('chart.text_pos_left') }}</el-radio-button>
<el-radio-button label="right">{{ $t('chart.text_pos_right') }}</el-radio-button>
</el-radio-group>
</el-form-item> </el-form-item>
<el-form-item class="form-item"> <el-form-item class="form-item">
<span slot="label"> <span slot="label">
...@@ -35,7 +34,7 @@ ...@@ -35,7 +34,7 @@
<span>{{ $t('chart.content_formatter') }}</span> <span>{{ $t('chart.content_formatter') }}</span>
<el-tooltip class="item" effect="dark" placement="bottom"> <el-tooltip class="item" effect="dark" placement="bottom">
<div slot="content"> <div slot="content">
字符串支持用 \n 换行<br>字符串模板 模板变量有:<br>{a}:系列名。<br>{b}:数据名。<br>{c}:数据值。 字符串支持用 \n 换行<br>字符串模板 模板变量有:<br>{a}:系列名。<br>{b}:数据名。<br>{c}:数据值。<br>{d}:百分比(用于饼图等)。
</div> </div>
<i class="el-icon-info" style="cursor: pointer;" /> <i class="el-icon-info" style="cursor: pointer;" />
</el-tooltip> </el-tooltip>
...@@ -97,7 +96,16 @@ export default { ...@@ -97,7 +96,16 @@ export default {
return { return {
labelForm: JSON.parse(JSON.stringify(DEFAULT_LABEL)), labelForm: JSON.parse(JSON.stringify(DEFAULT_LABEL)),
fontSize: [], fontSize: [],
isSetting: false isSetting: false,
labelPosition: [
{ name: this.$t('chart.inside'), value: 'inside' },
{ name: this.$t('chart.outside'), value: 'outside' },
{ name: this.$t('chart.center'), value: 'center' },
{ name: this.$t('chart.text_pos_top'), value: 'top' },
{ name: this.$t('chart.text_pos_bottom'), value: 'bottom' },
{ name: this.$t('chart.text_pos_left'), value: 'left' },
{ name: this.$t('chart.text_pos_right'), value: 'right' }
]
} }
}, },
watch: { watch: {
...@@ -113,6 +121,9 @@ export default { ...@@ -113,6 +121,9 @@ export default {
} }
if (customAttr.label) { if (customAttr.label) {
this.labelForm = customAttr.label this.labelForm = customAttr.label
if (!this.labelForm.labelLine) {
this.labelForm.labelLine = JSON.parse(JSON.stringify(DEFAULT_LABEL.labelLine))
}
} }
} }
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论