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/09/29 03:33:39 UTC

[echarts] branch fix-pie created (now 91382c21a)

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

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


      at 91382c21a fix(pie): fix a NPE of `labelLine` when `minShowLabelRadian` is set.

This branch includes the following new commits:

     new 91382c21a fix(pie): fix a NPE of `labelLine` when `minShowLabelRadian` is set.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



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


[echarts] 01/01: fix(pie): fix a NPE of `labelLine` when `minShowLabelRadian` is set.

Posted by wa...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 91382c21a86f3afe89b251621aa8fd7ee461220b
Author: plainheart <yh...@all-my-life.cn>
AuthorDate: Thu Sep 29 11:31:05 2022 +0800

    fix(pie): fix a NPE of `labelLine` when `minShowLabelRadian` is set.
---
 src/chart/pie/labelLayout.ts |  7 +++++--
 test/pie-label.html          | 35 +++++++++++++++++++++++++++++++++++
 2 files changed, 40 insertions(+), 2 deletions(-)

diff --git a/src/chart/pie/labelLayout.ts b/src/chart/pie/labelLayout.ts
index 0c9090891..4ed96f3ac 100644
--- a/src/chart/pie/labelLayout.ts
+++ b/src/chart/pie/labelLayout.ts
@@ -394,8 +394,11 @@ export default function pieLabelLayout(
 
         if (Math.abs(sectorShape.endAngle - sectorShape.startAngle) < minShowLabelRadian) {
             each(label.states, setNotShow);
-            each(labelLine.states, setNotShow);
-            label.ignore = labelLine.ignore = true;
+            label.ignore = true;
+            if (labelLine) {
+                each(labelLine.states, setNotShow);
+                labelLine.ignore = true;
+            }
             return;
         }
 
diff --git a/test/pie-label.html b/test/pie-label.html
index 23cb8d39a..4738d0e17 100644
--- a/test/pie-label.html
+++ b/test/pie-label.html
@@ -52,6 +52,7 @@ under the License.
         <div id="main9"></div>
         <div id="main10"></div>
         <div id="main11"></div>
+        <div id="main12"></div>
 
         <script>
 
@@ -981,5 +982,39 @@ under the License.
                 });
             });
         </script>
+
+        <script>
+            require([
+                'echarts'
+            ], function (echarts) {
+                var option = {
+                    series: [{
+                        type: 'pie',
+                        radius: ['40%', '70%'],
+                        minShowLabelAngle: 100,
+                        label: {
+                            show: true,
+                            position: 'inside'
+                        },
+                        data: [
+                            { value: 1048, name: 'Search Engine' },
+                            { value: 735, name: 'Direct' },
+                            { value: 580, name: 'Email' },
+                            { value: 484, name: 'Union Ads' },
+                            { value: 300, name: 'Video Ads' }
+                        ]
+                    }]
+                };
+
+                var chart = testHelper.create(echarts, 'main12', {
+                    title: [
+                        'The labels should be rendered correctly and no errors in the console',
+                        'Test case from issue #17712',
+                    ],
+                    height: 300,
+                    option: option
+                });
+            });
+        </script>
     </body>
 </html>


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