From 61bdb7b81dd3d55e3a76c8351c8bf3f6048d351a Mon Sep 17 00:00:00 2001 From: jianneng-fit2cloud Date: Wed, 23 Oct 2024 18:55:34 +0800 Subject: [PATCH] =?UTF-8?q?style(=E5=9B=BE=E8=A1=A8):=20=E6=A0=87=E7=AD=BE?= =?UTF-8?q?=E7=9A=84=E5=85=A8=E9=87=8F=E6=98=BE=E7=A4=BA=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=8F=8A=E7=AC=A6=E5=8F=B7=E5=9C=B0=E5=9B=BE?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E6=A0=87=E7=AD=BE=E7=9A=84=E5=85=A8=E9=87=8F?= =?UTF-8?q?=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../editor-style/components/LabelSelector.vue | 2 +- .../js/panel/charts/map/symbolic-map.ts | 1 + .../components/js/panel/charts/pie/pie.ts | 33 ++++++++++--------- .../components/js/panel/common/common_antv.ts | 9 ++++- 4 files changed, 28 insertions(+), 17 deletions(-) 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 0b7e0dfed9..02a63739fe 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 @@ -449,7 +449,7 @@ const conversionPrecision = [ { name: t('chart.reserve_two'), value: 2 } ] const noFullDisplay = computed(() => { - return !['symbolic-map', 'liquid', 'gauge', 'indicator'].includes(props.chart.type) + return !['liquid', 'gauge', 'indicator'].includes(props.chart.type) }) diff --git a/core/core-frontend/src/views/chart/components/js/panel/charts/map/symbolic-map.ts b/core/core-frontend/src/views/chart/components/js/panel/charts/map/symbolic-map.ts index 1387298d96..3271e3e801 100644 --- a/core/core-frontend/src/views/chart/components/js/panel/charts/map/symbolic-map.ts +++ b/core/core-frontend/src/views/chart/components/js/panel/charts/map/symbolic-map.ts @@ -408,6 +408,7 @@ export class SymbolicMap extends L7ChartView { .color(label.color) .size(label.fontSize) .style({ + textAllowOverlap: label.fullDisplay, textAnchor: 'center', textOffset: [0, 0] }) diff --git a/core/core-frontend/src/views/chart/components/js/panel/charts/pie/pie.ts b/core/core-frontend/src/views/chart/components/js/panel/charts/pie/pie.ts index 75670af8e6..192b80d6ce 100644 --- a/core/core-frontend/src/views/chart/components/js/panel/charts/pie/pie.ts +++ b/core/core-frontend/src/views/chart/components/js/panel/charts/pie/pie.ts @@ -130,24 +130,27 @@ export class Pie extends G2PlotChartView { } } const layout = [] - const type = - labelAttr.position === 'inner' - ? labelAttr.fullDisplay - ? 'limit-in-plot' - : 'custom-layout' - : labelAttr.fullDisplay - ? 'hide-overlap' - : 'limit-in-plot' - - if (type === 'custom-layout') { - const tmpOptions = super.configLabel(chart, options) - layout.push({ type: 'limit-in-plot' }) - layout.push(...tmpOptions.label.layout) + let textAlign = undefined + if (labelAttr.position === 'inner') { + textAlign = 'center' + if (labelAttr.fullDisplay) { + layout.push({ type: 'limit-in-plot' }) + } else { + layout.push({ type: 'limit-in-canvas' }) + layout.push({ type: 'hide-overlap' }) + } } else { - layout.push({ type }) + if (!labelAttr.fullDisplay) { + layout.push({ type: 'limit-in-plot' }) + } + } + let labelType = labelAttr.position === 'outer' ? 'spider' : labelAttr.position + if (layout.length === 0) { + labelType = 'no' } const label = { - type: labelAttr.position === 'outer' ? 'spider' : labelAttr.position, + type: labelType, + textAlign, layout, autoRotate: false, style: { diff --git a/core/core-frontend/src/views/chart/components/js/panel/common/common_antv.ts b/core/core-frontend/src/views/chart/components/js/panel/common/common_antv.ts index fac171275b..a0656402f2 100644 --- a/core/core-frontend/src/views/chart/components/js/panel/common/common_antv.ts +++ b/core/core-frontend/src/views/chart/components/js/panel/common/common_antv.ts @@ -157,7 +157,14 @@ export function getLabel(chart: Chart) { layout.push({ type: 'interval-hide-overlap' }) } else if ( chart.type.indexOf('-horizontal') > -1 || - ['bidirectional-bar', 'progress-bar', 'pie', 'pie-donut', 'radar'].includes(chart.type) + [ + 'bidirectional-bar', + 'progress-bar', + 'pie-donut', + 'radar', + 'waterfall', + 't-heatmap' + ].includes(chart.type) ) { layout.push({ type: 'hide-overlap' }) } else {