From 5f611a26c3353c92890ad80ea4719b8070f1e138 Mon Sep 17 00:00:00 2001 From: "hong.yang" <hong.yang@ustcinfo.com> Date: Thu, 2 Nov 2023 17:58:17 +0800 Subject: [PATCH 1/3] =?UTF-8?q?feat:=20=E9=A5=BC=E5=9B=BE=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E5=86=85=E9=83=A8=E6=A0=87=E7=AD=BE=E6=98=AF=E5=90=A6?= =?UTF-8?q?=E6=97=8B=E8=BD=AC=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data-room-ui/packages/G2Plots/饼图/基础饼图.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/data-room-ui/packages/G2Plots/饼图/基础饼图.js b/data-room-ui/packages/G2Plots/饼图/基础饼图.js index e7f565f7..7acf3189 100644 --- a/data-room-ui/packages/G2Plots/饼图/基础饼图.js +++ b/data-room-ui/packages/G2Plots/饼图/基础饼图.js @@ -76,6 +76,17 @@ const setting = [ ], groupName: 'graph' }, + { + label: '旋转内部标签', + type: 'switch', // 设置组件类型 + field: 'labelAutoRotate', // 字段 + optionField: 'label.autoRotate', // 对应options中的字段 + value: true, + active: true, + inactive: false, + tabName: 'custom', + groupName: 'graph' + }, { label: '标签颜色', // 设置组件类型 @@ -257,6 +268,7 @@ const option = { }, color: ['#6b74e4', '#4391f4', '#38bbe5', '#69d6fd', '#36c6a0'], label: { + autoRotate: true, type: 'inner', labelHeight: 50, labelLine: { From e6cf38ba670da44193cce96f7f8081b55919a7cb Mon Sep 17 00:00:00 2001 From: "hong.yang" <hong.yang@ustcinfo.com> Date: Fri, 3 Nov 2023 13:51:41 +0800 Subject: [PATCH 2/3] =?UTF-8?q?fix=EF=BC=9A=20=E4=BB=AA=E8=A1=A8=E7=9B=98?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E8=AE=BE=E7=BD=AE=E6=8C=87=E6=A0=87=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E7=9A=84=E5=B0=8F=E6=95=B0=E4=BD=8D=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../packages/G2Plots/进度图/仪表盘.js | 19 ++++++++++++++++++- .../G2Plots/进度图/进度仪表盘.js | 17 ++++++++++++++++- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/data-room-ui/packages/G2Plots/进度图/仪表盘.js b/data-room-ui/packages/G2Plots/进度图/仪表盘.js index de84471b..eeae9572 100644 --- a/data-room-ui/packages/G2Plots/进度图/仪表盘.js +++ b/data-room-ui/packages/G2Plots/进度图/仪表盘.js @@ -99,6 +99,18 @@ const setting = [ tabName: 'custom', groupName: 'graph' }, + { + label: '指标小数位', + // 设置组件类型 + type: 'inputNumber', + // 字段 + field: 'statistic_fixed', + // 对应options中的字段 + optionField: 'statisticFixed', + value: 0, + tabName: 'custom', + groupName: 'graph' + }, { label: '指标字体类型', // 设置组件类型 @@ -185,7 +197,11 @@ const data = [ } ] // 配置处理脚本 -const optionHandler ='option.range.color = [option.color1, option.color2]' +const optionHandler ='option.range.color = [option.color1, option.color2]\n' + + ' let fix = option.statisticFixed\n' + + ' option.statistic.title.formatter = ({ percent }) => `${(percent * 100).toFixed(fix)}%`' + + // 数据处理脚本 const dataHandler = '// 取返回数据列表的第一项指标值\noption.percent = data[0][setting.filter(settingItem=>settingItem.field === \'percent\')[0].value]' @@ -226,6 +242,7 @@ const option = { // shapeStyle: { // fill: 'rgba(208,208,208,0)' // }, + statisticFixed: 0, statistic: { title: { offsetY: 0, diff --git a/data-room-ui/packages/G2Plots/进度图/进度仪表盘.js b/data-room-ui/packages/G2Plots/进度图/进度仪表盘.js index 15ad569b..0fb9c1b5 100644 --- a/data-room-ui/packages/G2Plots/进度图/进度仪表盘.js +++ b/data-room-ui/packages/G2Plots/进度图/进度仪表盘.js @@ -75,6 +75,18 @@ const setting = [ tabName: 'custom', groupName: 'graph' }, + { + label: '指标小数位', + // 设置组件类型 + type: 'inputNumber', + // 字段 + field: 'statistic_fixed', + // 对应options中的字段 + optionField: 'statisticFixed', + value: 0, + tabName: 'custom', + groupName: 'graph' + }, { label: '指标字体类型', // 设置组件类型 @@ -160,7 +172,9 @@ const data = [ } ] // 配置处理脚本 -const optionHandler ='option.range.color = [option.color1, option.color2]' +const optionHandler ='option.range.color = [option.color1, option.color2]\n' + + ' let fix = option.statisticFixed\n' + + ' option.statistic.title.formatter = ({ percent }) => `${(percent * 100).toFixed(fix)}%`' // 数据处理脚本 const dataHandler = '// 取返回数据列表的第一项指标值\noption.percent = data[0][setting.filter(settingItem=>settingItem.field === \'percent\')[0].value]' @@ -175,6 +189,7 @@ const option = { range: { color: ['l(0) 0:#6b74e4 1:#4391f4','#d0d0d0'] }, + statisticFixed: 0, startAngle: Math.PI, endAngle: 2 * Math.PI, indicator: null, From 7dfb749f2c2c2fdd8b68694b97b04b26d8ec83e7 Mon Sep 17 00:00:00 2001 From: "hong.yang" <hong.yang@ustcinfo.com> Date: Fri, 3 Nov 2023 16:32:07 +0800 Subject: [PATCH 3/3] =?UTF-8?q?fix:=20=E4=BC=98=E5=8C=96G2=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E7=9A=84=E5=8A=A8=E6=80=81=E9=85=8D=E7=BD=AE=E8=B5=8B?= =?UTF-8?q?=E5=80=BC=EF=BC=8C=E5=AF=B9=E4=BA=8E=E5=B1=9E=E6=80=A7=E8=B7=AF?= =?UTF-8?q?=E5=BE=84=EF=BC=8C=E5=B0=86=E4=B8=8D=E5=AD=98=E5=9C=A8=E7=9A=84?= =?UTF-8?q?=E5=B1=9E=E6=80=A7=E8=B5=8B=E5=80=BC=E7=A9=BA=E5=AF=B9=E8=B1=A1?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data-room-ui/packages/PlotRender/index.vue | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/data-room-ui/packages/PlotRender/index.vue b/data-room-ui/packages/PlotRender/index.vue index b67a2f38..be6cd8ed 100644 --- a/data-room-ui/packages/PlotRender/index.vue +++ b/data-room-ui/packages/PlotRender/index.vue @@ -147,7 +147,9 @@ export default { let option = null config.setting.forEach(set => { if (set.optionField) { + // 例 point.style.fill const optionField = set.optionField.split('.') + // 例 [point,style,fill] option = config.option optionField.forEach((field, index) => { if (index === optionField.length - 1) { @@ -156,6 +158,10 @@ export default { option[field] = set.value } } else { + // 如果没有这个属性,则创建该属性,并赋值为空对值 + if (!option[field]) { + option[field] = {} + } option = option[field] } })