New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

桑基图数据错误导致页面卡死 #7495

Closed
DYS1230 opened this Issue Jan 16, 2018 · 6 comments

Comments

Projects
None yet
6 participants
@DYS1230

DYS1230 commented Jan 16, 2018

One-line summary [问题简述]

桑基图数据错误导致页面卡死

Version & Environment [版本及环境]

  • ECharts version [ECharts 版本]: 4.0.0
  • Browser version [浏览器类型和版本]:
  • OS Version [操作系统类型和版本]:

Expected behaviour [期望结果]

应该报错,而不不是陷入死循环导致页面卡死

ECharts option [ECharts配置项]

option = {
	series: {
		type: 'sankey',
		data: [{
			name: 'A'
		}, {
			name: 'B'
		}],
		links: [{
			source: 'A',
			target: 'A',
			value: 2000
		}]
	}
}
或者
option = {
	series: {
		type: 'sankey',
		data: [{
			name: 'A'
		}, {
			name: 'B'
		}],
		links: [{
			source: 'A',
			target: 'B',
			value: 2000
		}, {
			source: 'B',
			target: 'A',
			value: 2000
		}]
	}
}

Other comments [其他信息]

@wufeng123456

This comment has been minimized.

wufeng123456 commented Feb 24, 2018

最好能兼容,如果仅报错 这个死循环本身就很难处理 ,
导致死循环原因:
1条数据: A——>A ,
2条数据:A——>B;B——>A,
3条数据:A——>B;B——>C; C——>A,
......
......
......
100条数据:A——>B;B——>C; C——>D;....... ; X——>A
同理:
如果是1000条数据、10000条 甚至更多的数据 形成了一个死循环(闭包)
这种本身就很难被发现,拆除这种闭包的算法也很头疼

@harrymiya

This comment has been minimized.

harrymiya commented Mar 15, 2018

+1 我同事都要崩溃了,他叫贾神

@jiazihanqq

This comment has been minimized.

jiazihanqq commented Mar 16, 2018

在使用桑基图时,不同的维度上经常会出现相同命名的数据,比如 “地区”维度中 存在“其他”,“行业”维度中也出现“其他”,如果绘图时只是剔除了这样的数据,是否会造成数据对不上?

@deqingli

This comment has been minimized.

Member

deqingli commented Apr 9, 2018

sankey 图理论上是不支持环状数据的,所以会尝试在数据层面约束下

@deqingli

This comment has been minimized.

Member

deqingli commented Apr 11, 2018

你好,这个问题是由于原始输入数据中存在环导致的。sankey 图理论上只支持有向无环图(DAG, Directed Acyclic Graph),所以原先的布局算法是默认输入数据是有向无环的,当有环的时候就会陷入死循环,当然这主要是我前期开发的时候欠考虑导致的,我会好好反思的。修改后的布局算法是按拓扑顺序遍历计算布局的,如果判断有环就会报错,不再绘制。

@deqingli deqingli closed this Apr 11, 2018

@deqingli

This comment has been minimized.

Member

deqingli commented Apr 11, 2018

修改后的功能会随下个版本一起发布,欢迎大家验证,如果有问题可以 reopen 这个 issue. ~ 祝好

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment