You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by wa...@apache.org on 2022/07/21 08:30:52 UTC

[echarts] 01/01: fix(pie): fix `labelLine` may not be hidden when `minShowLabelRadian` is specified, resolves #17013.

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

wangzx pushed a commit to branch fix-pie-labelLine
in repository https://gitbox.apache.org/repos/asf/echarts.git

commit d5ee24d755d0fa1c7adf1cc4c484e862b2f4ffb2
Author: plainheart <yh...@all-my-life.cn>
AuthorDate: Thu Jul 21 16:29:24 2022 +0800

    fix(pie): fix `labelLine` may not be hidden when `minShowLabelRadian` is specified, resolves #17013.
---
 src/chart/pie/labelLayout.ts        |   3 +-
 test/pie-label.html                 | 120 +++++++++++++++++++++++++++++++++++-
 test/runTest/actions/__meta__.json  |   1 +
 test/runTest/actions/pie-label.json |   1 +
 4 files changed, 122 insertions(+), 3 deletions(-)

diff --git a/src/chart/pie/labelLayout.ts b/src/chart/pie/labelLayout.ts
index 9aaf1bf22..0c9090891 100644
--- a/src/chart/pie/labelLayout.ts
+++ b/src/chart/pie/labelLayout.ts
@@ -394,7 +394,8 @@ export default function pieLabelLayout(
 
         if (Math.abs(sectorShape.endAngle - sectorShape.startAngle) < minShowLabelRadian) {
             each(label.states, setNotShow);
-            label.ignore = true;
+            each(labelLine.states, setNotShow);
+            label.ignore = labelLine.ignore = true;
             return;
         }
 
diff --git a/test/pie-label.html b/test/pie-label.html
index 85541efd7..23cb8d39a 100644
--- a/test/pie-label.html
+++ b/test/pie-label.html
@@ -51,7 +51,7 @@ under the License.
         <div id="main8"></div>
         <div id="main9"></div>
         <div id="main10"></div>
-
+        <div id="main11"></div>
 
         <script>
 
@@ -828,7 +828,7 @@ under the License.
                         },
                     ],
                 };
-            
+
                 var chart = testHelper.create(echarts, 'main10', {
                     title: [
                         'Label line should hide when emphasis after update the emphasis.labelLine',
@@ -865,5 +865,121 @@ under the License.
 
             });
         </script>
+
+        <script>
+            require([
+                'echarts'
+            ], function (echarts) {
+                var option = {
+                    series: [{
+                        data: [
+                            {
+                                name: '三门峡市',
+                                value: 4702
+                            },
+                            {
+                                name: '内江市',
+                                value: 4516
+                            },
+                            {
+                                name: '天门市',
+                                value: 1316
+                            },
+                            {
+                                name: '昭通市',
+                                value: 6188
+                            },
+                            {
+                                name: '娄底市',
+                                value: 7120
+                            },
+                            {
+                                name: '博尔塔拉州',
+                                value: 189
+                            },
+                            {
+                                name: '丽水市',
+                                value: 6478
+                            },
+                            {
+                                name: '牡丹江市',
+                                value: 5540
+                            },
+                            {
+                                name: '桂林市',
+                                value: 15518
+                            },
+                            {
+                                name: '桃园市',
+                                value: 86
+                            },
+                            {
+                                name: '晋中市',
+                                value: 10661
+                            },
+                            {
+                                name: '雅安市',
+                                value: 2411
+                            },
+                            {
+                                name: '文昌市',
+                                value: 1420
+                            },
+                            {
+                                name: '广州市',
+                                value: 159522
+                            },
+                            {
+                                name: '文山壮族苗族自治州',
+                                value: 3168
+                            },
+                            {
+                                name: '晋城市',
+                                value: 8640
+                            },
+                            {
+                                name: '昌都市',
+                                value: 507
+                            },
+                            {
+                                name: '曲靖市',
+                                value: 10705
+                            },
+                            {
+                                name: '昌吉州',
+                                value: 801
+                            },
+                            {
+                                name: '其他',
+                                value: 60280480,
+                                selected: false
+                            }
+                        ],
+                        type: 'pie',
+                        radius: '70%',
+                        minAngle: 1,
+                        minShowLabelAngle: 2
+                    }],
+                    legend: {
+                        show: true,
+                        orient: 'vertical',
+                        left: 'left',
+                        selected: {
+                            '其他': false
+                        }
+                    }
+                };
+
+
+                var chart = testHelper.create(echarts, 'main11', {
+                    title: [
+                        'Label line should be hidden after clicking the legend item **其他**',
+                        'Test case from issue #17013',
+                    ],
+                    height: 300,
+                    option: option
+                });
+            });
+        </script>
     </body>
 </html>
diff --git a/test/runTest/actions/__meta__.json b/test/runTest/actions/__meta__.json
index ae9e2a699..5de0031e9 100644
--- a/test/runTest/actions/__meta__.json
+++ b/test/runTest/actions/__meta__.json
@@ -149,6 +149,7 @@
   "pie-animation": 2,
   "pie-calculable": 1,
   "pie-cornerRadius": 1,
+  "pie-label": 2,
   "pie-label-extreme": 2,
   "polar-rounded": 3,
   "polarLine": 1,
diff --git a/test/runTest/actions/pie-label.json b/test/runTest/actions/pie-label.json
new file mode 100644
index 000000000..44ede7c77
--- /dev/null
+++ b/test/runTest/actions/pie-label.json
@@ -0,0 +1 @@
+[{"name":"Action 1","ops":[{"type":"mousemove","time":299,"x":274,"y":345},{"type":"mousemove","time":499,"x":336,"y":332},{"type":"screenshot","time":1769},{"type":"mousemove","time":2799,"x":337,"y":332},{"type":"mousemove","time":2999,"x":316,"y":331},{"type":"mousemove","time":3205,"x":188,"y":277},{"type":"mousemove","time":3419,"x":152,"y":223},{"type":"mousemove","time":3620,"x":134,"y":197},{"type":"mousedown","time":3688,"x":133,"y":189},{"type":"mousemove","time":3837,"x":133," [...]
\ No newline at end of file


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