Skip to content

Sankey nodes overlap by default #2480

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

Closed
rahul-ldn opened this issue Mar 19, 2018 · 4 comments
Closed

Sankey nodes overlap by default #2480

rahul-ldn opened this issue Mar 19, 2018 · 4 comments
Labels
bug something broken

Comments

@rahul-ldn
Copy link

rahul-ldn commented Mar 19, 2018

Hi there,

As you can see here, a relatively simply sankey will often end up with nodes overlapping with other nodes, and the outgoing flows stacked as well. The code generating this diagram can be found here

Is there a reason this is happening?

Thanks!
R

@etpinard etpinard added the bug something broken label Mar 19, 2018
@etpinard
Copy link
Contributor

Thanks for the report.

@rahul-ldn
Copy link
Author

rahul-ldn commented Mar 19, 2018

Update: It appears to be browser-specific; Chrome 65 has this issue, but the diagram renders properly on Safari 11 (both on Mac OS 10.13 High Sierra)

@alexcjohnson
Copy link
Collaborator

And yet a different result in FF (image is Chrome / FF / Safari):
screen shot 2018-04-29 at 1 18 54 pm

Here it is as a pared-down codepen https://codepen.io/alexcjohnson/pen/NMdMbE?editors=1010
Even in Safari it's not quite right - there is no overlap at least, but there's a net upward shift from left to right that should not be there.

@alexcjohnson
Copy link
Collaborator

Update: the issue here is with a link with value: 0 (element 5 in this graph's link.value array, that leads to node 15 having zero size). If I replace that with anything positive the layout is fixed. The zero results in a NaN in the node list, and I suspect the breakage and the browser-dependence of the problem have to do with strange handling of NaN in Array.sort or the like.

Obviously we need to prevent a zero (or otherwise invalid) value from breaking things, but the question then is, what should this do? Should we delete it completely? Draw it as a very thin node & link (labeled as size zero)?

Negative or non-numeric values I feel confident we should ignore, but I feel like there may be cases you still want a zero-size node to show up. Thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken
Projects
None yet
Development

No branches or pull requests

3 participants