Skip to content
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

Dummy nodes to avoid confusing intersections? #32

Open
mbostock opened this issue Jun 13, 2017 · 0 comments
Open

Dummy nodes to avoid confusing intersections? #32

mbostock opened this issue Jun 13, 2017 · 0 comments

Comments

@mbostock
Copy link
Member

If you have links like A→B→C and another link that skips a layer like A→C, it’s really easy for the A→C link to intersect the B node. To illustrate in the energy flow diagram:

Sankey diagram

Here the 46 TWh link from Solid (in purple) to Industry (in blue) spuriously intersects Thermal generation and Electricity grid. Likewise the 49 Twh link from Gas to Industry intersects Electricity grid. This is mitigated only by the stroke opacity indicating overlap and that the tangents are not horizontal where the spurious intersection occurs.

One way to reduce these intersections would be to introduce dummy nodes (invisible nodes) in the intermediate layers. Since the link from Solid to Industry spans five layers, you might insert four intermediate dummy nodes: Solid→dummy→dummy→dummy→dummy→Industry. The first would help avoid intersection with Thermal generation, the next with Electricity grid, and so on. Ideally, the dummy nodes would only be used if the link intersected a node… although detecting intersection is tricky, since it requires making an assumption about how the links are rendered, and then complex Bézier math. Another possibility is that we don’t require horizontal tangents for the strokes when using the dummy nodes.

In any case, this isn’t easy—it will also require changing the representation of links so that a path (a sequence of control points) is returned rather than just a source and a target position. But I do think it could make a substantive improvement to the overall layout.

@mbostock mbostock changed the title Use dummy nodes to avoid confusing intersections. Dummy nodes to avoid confusing intersections? Jun 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant