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 2025/04/09 02:32:19 UTC
(echarts) branch fix/pie/labelLine-remove-error created (now b9e5bb09b)
This is an automated email from the ASF dual-hosted git repository.
wangzx pushed a change to branch fix/pie/labelLine-remove-error
in repository https://gitbox.apache.org/repos/asf/echarts.git
at b9e5bb09b fix(pie): fix labelLine may be not removed and cause error when single label position is not in outside.
This branch includes the following new commits:
new b9e5bb09b fix(pie): fix labelLine may be not removed and cause error when single label position is not in outside.
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 labelLine may be not removed and cause error when single label position is not in outside.
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/labelLine-remove-error
in repository https://gitbox.apache.org/repos/asf/echarts.git
commit b9e5bb09bd97587261ce244f19b404af61dee257
Author: plainheart <yh...@all-my-life.cn>
AuthorDate: Wed Apr 9 10:15:36 2025 +0800
fix(pie): fix labelLine may be not removed and cause error when single label position is not in outside.
- This fixes an error introduced in #14017, which gets label position from series model rather than data item model.
- Resolves #20904
- Resolves #20905
---
src/chart/pie/PieView.ts | 2 +-
test/pie-label.html | 53 ++++++++++++++++++++++++++++++++++++++++++++++--
2 files changed, 52 insertions(+), 3 deletions(-)
diff --git a/src/chart/pie/PieView.ts b/src/chart/pie/PieView.ts
index 04a81f1e6..56d1d7e0c 100644
--- a/src/chart/pie/PieView.ts
+++ b/src/chart/pie/PieView.ts
@@ -205,7 +205,7 @@ class PiePiece extends graphic.Sector {
z2: 10
});
- const labelPosition = seriesModel.get(['label', 'position']);
+ const labelPosition = itemModel.get(['label', 'position']);
if (labelPosition !== 'outside' && labelPosition !== 'outer') {
sector.removeTextGuideLine();
}
diff --git a/test/pie-label.html b/test/pie-label.html
index 048a70311..625bb4197 100644
--- a/test/pie-label.html
+++ b/test/pie-label.html
@@ -734,9 +734,29 @@ under the License.
name: '访问来源1',
type: 'pie',
radius: '50%',
+ center: ['50%', '50%'],
+ data: [
+ { value: 1, name: '搜索引擎' },
+ ],
+ emphasis: {
+ itemStyle: {
+ shadowBlur: 10,
+ shadowOffsetX: 0,
+ shadowColor: 'rgba(0, 0, 0, 0.5)'
+ }
+ },
+ label: {
+ position: 'outside'
+ }
+ },
+ {
+ name: '访问来源3',
+ type: 'pie',
+ radius: '50%',
center: ['75%', '50%'],
data: [
{ value: 1, name: '搜索引擎' },
+ { value: 1, name: '直接访问', label: { position: 'inside' } },
],
emphasis: {
itemStyle: {
@@ -768,12 +788,41 @@ under the License.
chart.setOption(option);
}, 6000);
+ setTimeout(() => {
+ option.series[2].data[0].label = { position: 'inside' };
+ chart.setOption(option);
+ }, 100);
+
var chart = testHelper.create(echarts, 'main8', {
- title: 'labelLine should be hidden when position is not \'outside\'',
+ title: [
+ 'labelLine should be **HIDDEN** when position is not \'outside\'',
+ // https://github.com/apache/echarts/issues/20904
+ // https://github.com/apache/echarts/issues/20905
+ 'The item **\'直接访问\'** of the third chart **SHOULD NOT** display labelLine'
+ ],
height: 300,
option: option
});
-
+ // should have no error in SVG renderer
+ try {
+ const dataUrl = chart.getDataURL()
+ // console.log(dataUrl)
+ } catch (e) {
+ console.error(e.stack)
+ chart.setOption({
+ title: {
+ right: 10,
+ top: 10,
+ text: 'ERROR: ' + e.toString(),
+ textStyle: {
+ width: 250,
+ color: 'red',
+ fontWeight: 'bold',
+ overflow: 'break'
+ }
+ }
+ })
+ }
});
</script>
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org