From 91739bbe8a5aba007ee99da795ce1fc450baf96c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=98=A5=E7=A7=8B=E5=8D=8A=E5=A4=8F?= Date: Wed, 10 Sep 2025 15:41:42 +0800 Subject: [PATCH 1/4] feat(pie):add `tangential-fixed` rotation mode to keep labels tangential without flipping. close #21257 --- src/chart/pie/PieSeries.ts | 2 +- src/chart/pie/labelLayout.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/chart/pie/PieSeries.ts b/src/chart/pie/PieSeries.ts index 0521d00e50..99fdbdff6b 100644 --- a/src/chart/pie/PieSeries.ts +++ b/src/chart/pie/PieSeries.ts @@ -68,7 +68,7 @@ export interface PieStateOption { labelLine?: PieLabelLineOption } interface PieLabelOption extends Omit { - rotate?: number | boolean | 'radial' | 'tangential' + rotate?: number | boolean | 'radial' | 'tangential' | 'tangential-fixed' alignTo?: 'none' | 'labelLine' | 'edge' edgeDistance?: string | number /** diff --git a/src/chart/pie/labelLayout.ts b/src/chart/pie/labelLayout.ts index b99d118577..5ea2ce031e 100644 --- a/src/chart/pie/labelLayout.ts +++ b/src/chart/pie/labelLayout.ts @@ -484,7 +484,7 @@ export default function pieLabelLayout( const radialAngle = nx < 0 ? -midAngle + PI : -midAngle; labelRotate = radialAngle; } - else if (rotate === 'tangential' + else if (rotate === 'tangential' || rotate === 'tangential-fixed' && labelPosition !== 'outside' && labelPosition !== 'outer' ) { let rad = Math.atan2(nx, ny); @@ -492,7 +492,7 @@ export default function pieLabelLayout( rad = PI * 2 + rad; } const isDown = ny > 0; - if (isDown) { + if (isDown && rotate !== 'tangential-fixed') { rad = PI + rad; } labelRotate = rad - PI; From f2570e740b72c9f05d99d087d2435d989f2d7a7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=98=A5=E7=A7=8B=E5=8D=8A=E5=A4=8F?= Date: Wed, 10 Sep 2025 16:14:24 +0800 Subject: [PATCH 2/4] feat(pie):add `tangential-fixed` rotation mode to keep labels tangential without flipping --- test/pie-label-rotate.html | 52 ++++++++++++++++++++++++++++++-------- 1 file changed, 42 insertions(+), 10 deletions(-) diff --git a/test/pie-label-rotate.html b/test/pie-label-rotate.html index 91ecea316a..5c4b47374c 100644 --- a/test/pie-label-rotate.html +++ b/test/pie-label-rotate.html @@ -39,7 +39,8 @@

Pie series label rotate

- - - - - -

Pie series label rotate

- -
- + + + + + +

Pie series label rotate

+ +
+ - + } + setPieChart(); + }); + + From fa2d67a98fddd881d78d3d1dc6d564e24d28900d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=98=A5=E7=A7=8B=E5=8D=8A=E5=A4=8F?= <2646403766@qq.com> Date: Tue, 14 Oct 2025 14:41:45 +0800 Subject: [PATCH 4/4] style(pie):fix unnecessary formatting in pie-label-rotate.html --- test/pie-label-rotate.html | 200 ++++++++++++++++++------------------- 1 file changed, 100 insertions(+), 100 deletions(-) diff --git a/test/pie-label-rotate.html b/test/pie-label-rotate.html index dd039c3dc4..ef061473b5 100644 --- a/test/pie-label-rotate.html +++ b/test/pie-label-rotate.html @@ -19,112 +19,112 @@ --> - - - - - - - - -

Pie series label rotate

- -
- + + + + + +

Pie series label rotate

+ +
+ - + +