This is an automated email from the ASF dual-hosted git repository.
wangzx 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 c2374966b Merge pull request #21425 from
fanwww/fix-pie-labelLine-smooth
c2374966b is described below
commit c2374966b5b5b6c64b58503132ed75a85f0fabdd
Author: fanwww <[email protected]>
AuthorDate: Mon Dec 15 20:55:34 2025 +0800
Merge pull request #21425 from fanwww/fix-pie-labelLine-smooth
fix(label): fix labelLine `smooth` can not be reset
---
src/label/labelGuideHelper.ts | 12 +++---
test/pie-labelLine-smooth.html | 90 ++++++++++++++++++++++++++++++++++++++++++
2 files changed, 96 insertions(+), 6 deletions(-)
diff --git a/src/label/labelGuideHelper.ts b/src/label/labelGuideHelper.ts
index 1177ceef0..1b80597f8 100644
--- a/src/label/labelGuideHelper.ts
+++ b/src/label/labelGuideHelper.ts
@@ -540,13 +540,13 @@ function setLabelLineState(
stateObj.ignore = ignore;
// Set smooth
let smooth = stateModel.get('smooth');
- if (smooth && smooth === true) {
- smooth = 0.3;
- }
+ smooth = smooth === true ? 0.3 : Math.max(+smooth, 0) || 0;
+
stateObj.shape = stateObj.shape || {};
- if (smooth > 0) {
- (stateObj.shape as Polyline['shape']).smooth = smooth as number;
- }
+
+ // always set the `smooth` property
+ (stateObj.shape as Polyline['shape']).smooth = smooth;
+
const styleObj = stateModel.getModel('lineStyle').getLineStyle();
isNormal ? labelLine.useStyle(styleObj) : stateObj.style = styleObj;
}
diff --git a/test/pie-labelLine-smooth.html b/test/pie-labelLine-smooth.html
new file mode 100644
index 000000000..28f8f66d9
--- /dev/null
+++ b/test/pie-labelLine-smooth.html
@@ -0,0 +1,90 @@
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<html>
+
+<head>
+ <meta charset="utf-8">
+ <script src="lib/simpleRequire.js"></script>
+ <script src="lib/config.js"></script>
+ <script src="data/pie-texture.js"></script>
+ <script src="lib/dat.gui.min.js"></script>
+ <link rel="stylesheet" href="lib/reset.css" />
+ <script src="lib/testHelper.js"></script>
+</head>
+
+<body>
+ <style>
+ </style>
+
+ <div id="main"></div>
+
+ <script>
+ require([
+ 'echarts'
+ ], function (echarts) {
+
+ let labelLine = {
+ smooth: false,
+ length:40
+ }
+ var option = {
+ series: [
+ {
+ type: 'pie',
+ selectedMode: 'single',
+ selectedOffset: 30,
+ radius: [50, 100],
+ hoverAnimation: false,
+ animation: false,
+ data: [
+ { value: 0, name: 'Direct Access' },
+ { value: 310, name: 'Email Marketing' },
+ { value: 234, name: 'Website Ads' },
+ { value: 135, name: 'Video Ads' },
+ { value: 1548, name: 'Search Engine' }
+ ],
+ labelLine
+ }
+ ]
+ };
+
+ function update() {
+ chart.setOption(option);
+ }
+
+ var gui = new dat.GUI();
+ gui.add(labelLine, 'smooth')
+ .onChange(update)
+ gui.add(labelLine, 'length')
+ .onChange(update)
+
+ var chart = testHelper.create(echarts, 'main', {
+ title: [
+ "Changing the smooth attribute from true to false in the
pie chart labelLine configuration item does not take effect",
+ 'See also https://github.com/apache/echarts/issues/21418'
+ ],
+ option
+ });
+ });
+ </script>
+
+</body>
+
+</html>
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]