diff --git a/src/chart/pie/PieSeries.ts b/src/chart/pie/PieSeries.ts index 0521d00e50..496d9a5e6a 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-noflip' alignTo?: 'none' | 'labelLine' | 'edge' edgeDistance?: string | number /** diff --git a/src/chart/pie/labelLayout.ts b/src/chart/pie/labelLayout.ts index b99d118577..e617e61895 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-noflip' && 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-noflip') { rad = PI + rad; } labelRotate = rad - PI; diff --git a/test/pie-label-rotate.html b/test/pie-label-rotate.html index 91ecea316a..ef061473b5 100644 --- a/test/pie-label-rotate.html +++ b/test/pie-label-rotate.html @@ -63,6 +63,7 @@

Pie series label rotate

undefined, 'radial', 'tangential', + 'tangential-noflip', 30 ]; @@ -103,7 +104,7 @@

Pie series label rotate

100 / rows / 2 * 0.6 + '%' ] }); - var rotText = j === 3 ? '30°' : rotates[j]; + var rotText = j === 4 ? '30°' : rotates[j]; title.push({ text: 'startAngle: ' + (rot ? 0 : 90) + '\n' + positions[i] + ', rotate: ' + rotText, left: 100 / cols * (j + 0.5) + '%',