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

Added option to turn off "moveSinksRight" #91

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Added option to turn off "moveSinksRight"
Sometimes you just don't want your sinks in the right stack!
  • Loading branch information
smashtie committed Apr 11, 2014
commit 4626de081953705b4538f6f985133a2b4b4fb0b8
11 changes: 9 additions & 2 deletions sankey/sankey.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -126,7 +133,7 @@ d3.sankey = function() {
}

//
moveSinksRight(x);
if (sinksRight) moveSinksRight(x);
scaleNodeBreadths((size[0] - nodeWidth) / (x - 1));
}

Expand Down