d3/d3-plugins — pull request #74 by gmadrid (2013-08-30 15:22:54+00:00)
Title: Sort sankey target links by descending slope.

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](https://f.cloud.github.com/assets/1387245/1058338/2b2a46be-1187-11e3-8434-822b70bc8501.png)

After:
![screen shot 2013-08-30 at 11 17 07 am](https://f.cloud.github.com/assets/1387245/1058345/413e5652-1187-11e3-8505-53455dba3544.png)