From a8ceb5b5e5f4bcc3085041acda1531b0ae8923fe Mon Sep 17 00:00:00 2001 From: Ovilia Date: Tue, 4 Jul 2023 17:26:58 +0800 Subject: [PATCH 1/3] fix(endLabel): endLabel fail with null data #18839 --- src/chart/line/LineView.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/chart/line/LineView.ts b/src/chart/line/LineView.ts index d16e341a72..8c07a3d93d 100644 --- a/src/chart/line/LineView.ts +++ b/src/chart/line/LineView.ts @@ -1299,7 +1299,10 @@ class LineView extends ChartView { }); } if (valueAnimation) { - labelInner(endLabel).setLabelText(value); + const inner = labelInner(endLabel); + if (inner && typeof inner.setLabelText === 'function') { + inner.setLabelText(value); + } } } } From ca3718af8b25eee8b53dfef0a36f5028b9b3c60c Mon Sep 17 00:00:00 2001 From: Ovilia Date: Tue, 4 Jul 2023 17:31:23 +0800 Subject: [PATCH 2/3] test(endLabel): add test case --- test/line-endLabel.html | 44 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/test/line-endLabel.html b/test/line-endLabel.html index 860fec0841..a0d5db2098 100644 --- a/test/line-endLabel.html +++ b/test/line-endLabel.html @@ -36,7 +36,7 @@ height: 1000px; margin-bottom: 30px; } - #main2, #main3 { + #main2, #main3, #main4 { width: 100%; height: 300px; margin-bottom: 30px; @@ -129,6 +129,7 @@
+
+ + From dd53fc9f18fa29f04f8d85cb46791ea9f0936a27 Mon Sep 17 00:00:00 2001 From: Ovilia Date: Wed, 5 Jul 2023 09:51:51 +0800 Subject: [PATCH 3/3] fix(endLabel): remove check of inner --- src/chart/line/LineView.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/chart/line/LineView.ts b/src/chart/line/LineView.ts index 8c07a3d93d..435fa2a90c 100644 --- a/src/chart/line/LineView.ts +++ b/src/chart/line/LineView.ts @@ -1300,7 +1300,7 @@ class LineView extends ChartView { } if (valueAnimation) { const inner = labelInner(endLabel); - if (inner && typeof inner.setLabelText === 'function') { + if (typeof inner.setLabelText === 'function') { inner.setLabelText(value); } }