diff --git a/data-room-ui/packages/G2Plots/饼图/基础环图.js b/data-room-ui/packages/G2Plots/饼图/基础环图.js index 6de6ee3e..8a6993e2 100644 --- a/data-room-ui/packages/G2Plots/饼图/基础环图.js +++ b/data-room-ui/packages/G2Plots/饼图/基础环图.js @@ -46,19 +46,32 @@ const setting = [ // 设置组件类型 type: 'select', // 字段 - field: 'label_content', + field: 'label_contentList', // 对应options中的字段 - optionField: 'label.content', - value: '{value}', + optionField: 'label.contentList', + value: ['{value}'], tabName: 'custom', + multiple: true, options: [ { label: '维度', value: '{name}' }, - { label: '指标', value: '{value}' } + { label: '指标', value: '{value}' }, + { label: '百分比', value: '{percentage}' }, ], step: 0.1, max: 1, groupName: 'graph' }, + { + label: '旋转内部标签', + type: 'switch', // 设置组件类型 + field: 'labelAutoRotate', // 字段 + optionField: 'label.autoRotate', // 对应options中的字段 + value: false, + active: true, + inactive: false, + tabName: 'custom', + groupName: 'graph' + }, { label: '标签位置', // 设置组件类型 @@ -365,7 +378,25 @@ const data = [ const optionHandler = 'option.legend = option.legendEnable ? {position: setting.find(settingItem=>settingItem.field === \'legendPosition\').value} : false;' + '\n if (option.legendEnable) {\n' + ' option.legend.itemName = option.legendItemName\n' + - ' }' + ' }' + + `if (option.label.contentList && option.label.contentList.length > 0) { + let content = '' + if (option.label.contentList.length === 1) { + content = option.label.contentList[0] + } else { + // 多行文本,加换行符,但是最后一行不加 + option.label.contentList.forEach((item, index) => { + if (index === option.label.contentList.length - 1) { + content += item + } else { + content += item + '\\n' + } + }) + } + option.label.content = content +}` + + // 数据处理脚本 const dataHandler = '' @@ -394,6 +425,7 @@ const option = { color: ['#6b74e4', '#4391f4', '#38bbe5', '#69d6fd', '#36c6a0'], label: { type: 'inner', + autoRotate: false, labelLine: { style: { stroke: '#5B8FF9', @@ -401,6 +433,7 @@ const option = { lineWidth: 1 } }, + contentList: [], content: '{value}', style: { fill: '#ffffff', diff --git a/data-room-ui/packages/G2Plots/饼图/基础饼图.js b/data-room-ui/packages/G2Plots/饼图/基础饼图.js index 7acf3189..6c995819 100644 --- a/data-room-ui/packages/G2Plots/饼图/基础饼图.js +++ b/data-room-ui/packages/G2Plots/饼图/基础饼图.js @@ -53,7 +53,8 @@ const setting = [ tabName: 'custom', options: [ { label: '维度', value: '{name}' }, - { label: '指标', value: '{value}' } + { label: '指标', value: '{value}' }, + { label: '百分比', value: '{percentage}' } ], step: 0.1, max: 1,