From 91382c21a86f3afe89b251621aa8fd7ee461220b Mon Sep 17 00:00:00 2001 From: plainheart Date: Thu, 29 Sep 2022 11:31:05 +0800 Subject: [PATCH] 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 0c90908914..4ed96f3ac3 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 23cb8d39a7..4738d0e17e 100644 --- a/test/pie-label.html +++ b/test/pie-label.html @@ -52,6 +52,7 @@
+
+ +