This is an automated email from the ASF dual-hosted git repository.

ovilia pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/echarts.git


The following commit(s) were added to refs/heads/master by this push:
     new 38ec1b589 fix #19050
     new ea28e4433 Merge pull request #19174 from shiersansi/fix-#19050
38ec1b589 is described below

commit 38ec1b589e64eac70f4a899674f215141453dd7b
Author: shier <3207840...@qq.com>
AuthorDate: Fri Oct 6 15:59:30 2023 +0800

    fix #19050
---
 src/chart/sunburst/SunburstPiece.ts | 37 ++++++++++++++++++++++++++++---------
 1 file changed, 28 insertions(+), 9 deletions(-)

diff --git a/src/chart/sunburst/SunburstPiece.ts 
b/src/chart/sunburst/SunburstPiece.ts
index 35d1d1ac0..091d8a1d7 100644
--- a/src/chart/sunburst/SunburstPiece.ts
+++ b/src/chart/sunburst/SunburstPiece.ts
@@ -20,7 +20,7 @@
 import * as zrUtil from 'zrender/src/core/util';
 import * as graphic from '../../util/graphic';
 import { toggleHoverEmphasis, SPECIAL_STATES, DISPLAY_STATES } from 
'../../util/states';
-import {createTextStyle} from '../../label/labelStyle';
+import { createTextStyle } from '../../label/labelStyle';
 import { TreeNode } from '../../data/Tree';
 import SunburstSeriesModel, { SunburstSeriesNodeItemOption, 
SunburstSeriesOption } from './SunburstSeries';
 import GlobalModel from '../../model/Global';
@@ -29,7 +29,7 @@ import { ColorString } from '../../util/types';
 import Model from '../../model/Model';
 import { getECData } from '../../util/innerStore';
 import { getSectorCornerRadius } from '../helper/sectorHelper';
-import {createOrUpdatePatternFromDecal} from '../../util/decal';
+import { createOrUpdatePatternFromDecal } from '../../util/decal';
 import ExtensionAPI from '../../core/ExtensionAPI';
 import { saveOldStyle } from '../../animation/basicTransition';
 import { normalizeRadian } from 'zrender/src/contain/util';
@@ -153,8 +153,8 @@ class SunburstPiece extends graphic.Sector {
 
         const focusOrIndices =
             focus === 'ancestor' ? node.getAncestorsIndices()
-            : focus === 'descendant' ? node.getDescendantIndices()
-            : focus;
+                : focus === 'descendant' ? node.getDescendantIndices()
+                    : focus;
 
         toggleHoverEmphasis(this, focusOrIndices, 
emphasisModel.get('blurScope'), emphasisModel.get('disabled'));
     }
@@ -217,7 +217,12 @@ class SunburstPiece extends graphic.Sector {
             let textAlign = getLabelAttr(labelStateModel, 'align');
             if (labelPosition === 'outside') {
                 r = layout.r + labelPadding;
-                textAlign = midAngle > Math.PI / 2 ? 'right' : 'left';
+                if (layout.clockwise) {
+                    textAlign = midAngle > Math.PI / 2 ? 'right' : 'left';
+                }
+                else {
+                    textAlign = midAngle > -Math.PI * 3 / 2 ? 'right' : 'left';
+                }
             }
             else {
                 if (!textAlign || textAlign === 'center') {
@@ -232,14 +237,28 @@ class SunburstPiece extends graphic.Sector {
                 }
                 else if (textAlign === 'left') {
                     r = layout.r0 + labelPadding;
-                    if (midAngle > Math.PI / 2 && !isRadianAroundZero(midAngle 
- Math.PI / 2)) {
-                        textAlign = 'right';
+                    if (layout.clockwise) {
+                        if (midAngle > Math.PI / 2 && 
!isRadianAroundZero(midAngle - Math.PI / 2)) {
+                            textAlign = 'right';
+                        }
+                    }
+                    else {
+                        if (midAngle > -Math.PI * 3 / 2 && 
!isRadianAroundZero(midAngle - Math.PI / 2)) {
+                            textAlign = 'right';
+                        }
                     }
                 }
                 else if (textAlign === 'right') {
                     r = layout.r - labelPadding;
-                    if (midAngle > Math.PI / 2 && !isRadianAroundZero(midAngle 
- Math.PI / 2)) {
-                        textAlign = 'left';
+                    if (layout.clockwise) {
+                        if (midAngle > Math.PI / 2 && 
!isRadianAroundZero(midAngle - Math.PI / 2)) {
+                            textAlign = 'left';
+                        }
+                    }
+                    else {
+                        if (midAngle > -Math.PI * 3 / 2 && 
!isRadianAroundZero(midAngle - Math.PI / 2)) {
+                            textAlign = 'left';
+                        }
                     }
                 }
             }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@echarts.apache.org
For additional commands, e-mail: commits-h...@echarts.apache.org

Reply via email to