diff --git a/sankey/sankey.js b/sankey/sankey.js index c3bc59f..e5db1e9 100644 --- a/sankey/sankey.js +++ b/sankey/sankey.js @@ -4,7 +4,8 @@ d3.sankey = function() { nodePadding = 8, size = [1, 1], nodes = [], - links = []; + links = [], + sinksRight = true; sankey.nodeWidth = function(_) { if (!arguments.length) return nodeWidth; @@ -36,6 +37,12 @@ d3.sankey = function() { return sankey; }; + sankey.sinksRight = function (_) { + if (!arguments.length) return sinksRight; + sinksRight = _; + return sankey; + }; + sankey.layout = function(iterations) { computeNodeLinks(); computeNodeValues(); @@ -126,7 +133,7 @@ d3.sankey = function() { } // - moveSinksRight(x); + if (sinksRight) moveSinksRight(x); scaleNodeBreadths((size[0] - nodeWidth) / (x - 1)); }