Skip to content
This repository has been archived by the owner on Nov 7, 2018. It is now read-only.

Sort sankey target links by descending slope. #74

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gmadrid
Copy link

@gmadrid gmadrid commented Aug 30, 2013

Looking at the Sankey example (http://bost.ocks.org/mike/sankey/), nodes like "Road transport" occur frequently which have crossing link lines. This creates unnecessary visual confusion. The problem occurs when a "higher" node is also farther left in the chart which causes the lines to cross as they reach the target. (Other nodes with the problem include "Electricity grid" and "Industry", although these are both more difficult to see in this particular chart.)

Using the link's slope (as if it were a straight line) as a heuristic, we can reduce the number of crossings at the target end.

Before:
screen shot 2013-08-30 at 11 16 21 am

After:
screen shot 2013-08-30 at 11 17 07 am

fbreitwieser added a commit to fbreitwieser/d3-sankey that referenced this pull request Oct 19, 2016
- has several modifications from networkD3 sankey.js
- included fixes and features from unmerged pull requests:
- d3/d3-plugins#124: Fix nodesByBreadth to have proper ordering
- - d3/d3-plugins#120: Added 'l-bezier' link type
- d3/d3-plugins#74: Sort sankey target links by descending slope
- d3#4: Add horizontal alignment option to Sankey layout
- added option numberFormat, default being ",.5g" (see , fixes
christophergandrud/networkD3#147)
- added option NodePosX, fixes christophergandrud/networkD3#108
- added option to force node ordering to be alphabetical along a path
(only works well with trees with one parent for each node, but might fix
christophergandrud/networkD3#153)
fbreitwieser added a commit to fbreitwieser/sankeyD3 that referenced this pull request Oct 19, 2016
Changelog:
 - ported to D3 v4
 - based on https://github.com/d3/d3-sankey
     - added several modifications from networkD3 sankey.js
     - included fixes and features from unmerged pull requests:
       - d3/d3-plugins#124: Fix nodesByBreadth to have proper ordering
       - d3/d3-plugins#120: Added 'l-bezier' link type
       - d3/d3-plugins#74: Sort sankey target links by descending slope
       - d3/d3-sankey#4: Add horizontal alignment option to Sankey layout
 - added option numberFormat, default being ",.5g" (see , fixesristophergandrud/networkD3#147)
 - added option NodePosX, fixes christophergandrud/networkD3#108
 - added option to force node ordering to be alphabetical along a path (only works well with trees with one parent for each node, but might fix christophergandrud/networkD3#153)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant