From 94577858786ba8e08c60c9af0229ab92ebd5f670 Mon Sep 17 00:00:00 2001 From: wisonic Date: Sun, 29 Sep 2024 20:40:36 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E5=9B=BE=E8=A1=A8):=20=E5=A0=86?= =?UTF-8?q?=E5=8F=A0=E6=9F=B1=E7=8A=B6=E5=9B=BE=E6=8C=87=E6=A0=87=E6=A0=87?= =?UTF-8?q?=E7=AD=BE=E5=92=8C=E6=80=BB=E8=AE=A1=E6=A0=87=E7=AD=BE=E5=88=86?= =?UTF-8?q?=E5=BC=80=E6=8E=A7=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/models/chart/chart-attr.d.ts | 4 + .../editor/editor-style/ChartStyle.vue | 9 +- .../editor-style/components/LabelSelector.vue | 56 +++++---- .../chart/components/editor/util/chart.ts | 3 +- .../components/js/panel/charts/bar/bar.ts | 107 +++++++++++------- 5 files changed, 114 insertions(+), 65 deletions(-) diff --git a/core/core-frontend/src/models/chart/chart-attr.d.ts b/core/core-frontend/src/models/chart/chart-attr.d.ts index a9f3d7e56f..d438f5d986 100644 --- a/core/core-frontend/src/models/chart/chart-attr.d.ts +++ b/core/core-frontend/src/models/chart/chart-attr.d.ts @@ -860,6 +860,10 @@ declare interface ChartLabelAttr { * 总计标签格式化设置 */ totalFormatter: BaseFormatter + /** + * 柱状图堆叠指标 + */ + showStackQuota: boolean } /** * 提示设置 diff --git a/core/core-frontend/src/views/chart/components/editor/editor-style/ChartStyle.vue b/core/core-frontend/src/views/chart/components/editor/editor-style/ChartStyle.vue index a019c5976b..0a4f646fec 100644 --- a/core/core-frontend/src/views/chart/components/editor/editor-style/ChartStyle.vue +++ b/core/core-frontend/src/views/chart/components/editor/editor-style/ChartStyle.vue @@ -432,9 +432,12 @@ watch( @onChangeMiscStyleForm="onChangeMiscStyleForm" /> - @@ -446,7 +449,7 @@ watch( :all-fields="props.allFields" @onLabelChange="onLabelChange" /> - + { if (chart.customAttr) { const customAttr = chart.customAttr if (customAttr.label) { + configCompat(customAttr.label) state.labelForm = defaultsDeep(customAttr.label, cloneDeep(COMPUTED_DEFAULT_LABEL.value)) if (chartType.value === 'liquid' && state.labelForm.fontSize < fontSizeList.value[0].value) { state.labelForm.fontSize = fontSizeList.value[0].value @@ -253,6 +255,11 @@ const init = () => { initPosition() } } +const configCompat = (labelAttr: DeepPartial) => { + if (labelAttr.showStackQuota === undefined) { + labelAttr.showStackQuota = labelAttr.show + } +} const checkLabelContent = contentProp => { if (chartType.value === 'funnel') { return false @@ -444,15 +451,6 @@ const conversionPrecision = [