echarts [Bug] 树形图 polyline 更新数据时连接线会消失

xxslljrj  于 5个月前  发布在  Echarts
关注(0)|答案(7)|浏览(59)

Version

5.4.3

https://echarts.apache.org/examples/zh/editor.html?c=tree-polyline&version=5.4.3&code=M4UwLgkgdmIE4DcCGAbAFAMwK5QMZgEsB7KNASgAIBvAKAotxODAoBMkwkKBeau-ilCQBbEAC4KAciSSANP3q4AFgRSs4IKBIDaCgbQGHBI8RQCyHJQDo4SKKyLDy8oxQC-LgQF1-bgNz8RAAOhCQ8fIagcAQgwDp69AauFGAAnkGmkmAaIHIJAuycOoVIXp6uIKwA5iAAykpIGRIAREFEKKkoBFAgzeVGKEgARiAoEknJFENIuADWVXBEOKwAwu1EcBKSAMQYe3mT9G3ABKFaUiggGGAHhwjwhLioAIJdVeeSwgSsrJe3k6gCO8ttEqkobvl6B5IRRLkh7nEIodBiMxkjDhRjqdiB9QeD_ncHgQnihXkCPl8fn9-gC3h9LtdJDCoTDoa43HofFCAvRhKkVg04GArKAwAB5EI4tDBM5kAIeCgAJgADKq5UA

Steps to Reproduce

setInterval(function() {
const data = {
name: 'a',
children: [
{
name: Math.random(),
},
]
};
option = {
series: [
{
type: 'tree',
data: [data],
edgeShape: "polyline",
label: {
backgroundColor: '#fff',
position: 'left',
verticalAlign: 'middle',
align: 'right'
},
leaves: {
label: {
position: 'right',
verticalAlign: 'middle',
align: 'left'
}
},
}
]
};
myChart.setOption(option);
}, 2000);

Current Behavior

当数据更新时,连接线消失

Expected Behavior

当数据更新时,连接线不消失

Environment

- OS: Windows 10.8.4
- Browser: Chrome 115
- Framework: None

Any additional comments?

No response

kkbh8khc

kkbh8khc1#

@genezx It seems you are not using English, I've helped translate the content automatically. To make your issue understood by more people and get helped, we'd like to suggest using English next time. 🤗
TRANSLATED

TITLE

[Bug] Treemap polyline connector disappears when updating data

6qqygrtg

6qqygrtg2#

This looks like a replace operation, not an update.
For a proper replace, use myChart.setOption(option, true); .
For an updatedo this .
Both work as intended.

0yg35tkg

0yg35tkg3#

This looks like a replace operation, not an update. For a proper replace, use myChart.setOption(option, true); . For an updatedo this . Both work as intended.

Thank you for reply, but the first solution myChart.setOption(option, true); does not work, and the second solution works.
And the third solution is:

echarts.dispose(chart);
	var myChart = echarts.init(chart);

I don't know why the first solution does not work.

yc0p9oo0

yc0p9oo04#

Because of edgeShape: "polyline", - remove it, sorry did not mention that.
NB: please close issue if problem solved.

7z5jn7bk

7z5jn7bk5#

I'm sorry but I need edgeShape: "polyline" because of the line style.

So the issue is not solved for update operation.
The only workaround is to dispose the instance and re-init.

frebpwbc

frebpwbc6#

It is all related to this bug #18448

相关问题