From 9978fc6f3f9cd2ec6e319c92ffad119ff62d4fa3 Mon Sep 17 00:00:00 2001 From: jianneng-fit2cloud Date: Mon, 25 Nov 2024 18:32:42 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E5=9B=BE=E8=A1=A8):=20=E4=BB=AA=E8=A1=A8?= =?UTF-8?q?=E7=9B=98=E6=94=AF=E6=8C=81=E6=98=BE=E7=A4=BA=E6=95=B0=E5=80=BC?= =?UTF-8?q?=E5=92=8C=E7=99=BE=E5=88=86=E6=AF=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/models/chart/chart-attr.d.ts | 4 + core/core-frontend/src/utils/canvasStyle.ts | 3 +- .../editor-style/components/LabelSelector.vue | 239 +++++++++++++++++- .../chart/components/editor/util/chart.ts | 10 +- .../js/panel/charts/others/gauge.ts | 27 +- 5 files changed, 274 insertions(+), 9 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 9c987be935..bf788a7382 100644 --- a/core/core-frontend/src/models/chart/chart-attr.d.ts +++ b/core/core-frontend/src/models/chart/chart-attr.d.ts @@ -946,6 +946,10 @@ declare interface ChartLabelAttr { * 全部显示 */ fullDisplay: boolean + /** + * 仪表盘占比显示格式 + */ + proportionSeriesFormatter: SeriesFormatter } /** * 提示设置 diff --git a/core/core-frontend/src/utils/canvasStyle.ts b/core/core-frontend/src/utils/canvasStyle.ts index ee77b6366b..c675a33a26 100644 --- a/core/core-frontend/src/utils/canvasStyle.ts +++ b/core/core-frontend/src/utils/canvasStyle.ts @@ -127,7 +127,8 @@ export const customAttrTrans = { ], label: { fontSize: '', - seriesLabelFormatter: ['fontSize'] + seriesLabelFormatter: ['fontSize'], + proportionSeriesFormatter: ['fontSize'] }, tooltip: { fontSize: '', diff --git a/core/core-frontend/src/views/chart/components/editor/editor-style/components/LabelSelector.vue b/core/core-frontend/src/views/chart/components/editor/editor-style/components/LabelSelector.vue index efc953d811..c463944dd5 100644 --- a/core/core-frontend/src/views/chart/components/editor/editor-style/components/LabelSelector.vue +++ b/core/core-frontend/src/views/chart/components/editor/editor-style/components/LabelSelector.vue @@ -238,7 +238,8 @@ const state = reactive<{ labelForm: DeepPartial }>({ seriesLabelFormatter: [], labelFormatter: DEFAULT_LABEL.labelFormatter, conversionTag: DEFAULT_LABEL.conversionTag, - totalFormatter: DEFAULT_LABEL.totalFormatter + totalFormatter: DEFAULT_LABEL.totalFormatter, + proportionSeriesFormatter: DEFAULT_LABEL.proportionSeriesFormatter } }) @@ -303,7 +304,10 @@ const showSeriesLabelFormatter = computed(() => { const showDivider = computed(() => { const DIVIDER_PROPS = ['labelFormatter', 'showDimension', 'showQuota', 'showProportion'] return ( - includesAny(props.propertyInner, ...DIVIDER_PROPS) && !isBarRangeTime.value && !isGroupBar.value + includesAny(props.propertyInner, ...DIVIDER_PROPS) && + !isBarRangeTime.value && + !isGroupBar.value && + !isGauge.value ) }) @@ -460,6 +464,9 @@ const conversionPrecision = [ const noFullDisplay = computed(() => { return !['liquid', 'gauge', 'indicator'].includes(props.chart.type) }) +const isGauge = computed(() => { + return props.chart.type === 'gauge' +})