From 1bedcd0107c2af108691e0419e060877d929b738 Mon Sep 17 00:00:00 2001 From: wisonic Date: Wed, 4 Dec 2024 16:49:54 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E5=9B=BE=E8=A1=A8):=20=E6=9F=B1?= =?UTF-8?q?=E7=8A=B6=E5=9B=BE=E8=B4=9F=E5=80=BC=E6=A0=87=E7=AD=BE=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E4=BD=8D=E7=BD=AE=E4=BC=98=E5=8C=96=20#13172?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../views/chart/components/js/panel/charts/bar/bar.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/core/core-frontend/src/views/chart/components/js/panel/charts/bar/bar.ts b/core/core-frontend/src/views/chart/components/js/panel/charts/bar/bar.ts index 6aaea3b836..4a424c1109 100644 --- a/core/core-frontend/src/views/chart/components/js/panel/charts/bar/bar.ts +++ b/core/core-frontend/src/views/chart/components/js/panel/charts/bar/bar.ts @@ -137,6 +137,17 @@ export class Bar extends G2PlotChartView { } }) return group + }, + position: data => { + if (data.value < 0) { + if (tmpOptions.label?.position === 'top') { + return 'bottom' + } + if (tmpOptions.label?.position === 'bottom') { + return 'top' + } + } + return tmpOptions.label?.position } } return {