From bc1752f5c9c088079e4f9dbafe26294c3aa2ab03 Mon Sep 17 00:00:00 2001 From: Rioting Pacifist Date: Tue, 7 Mar 2023 01:08:57 -0800 Subject: [PATCH 1/2] reverse sort order on sankey and increase iterations by 1 --- _src/js/sankey.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/_src/js/sankey.js b/_src/js/sankey.js index 203e17c2..122d56b8 100644 --- a/_src/js/sankey.js +++ b/_src/js/sankey.js @@ -162,11 +162,11 @@ d3.sankey = function() { initializeNodeDepth(); resolveCollisions(); centerFunds(); - for (var alpha = 1; iterations > 0; --iterations) { - relaxRightToLeft(alpha *= .99); - resolveCollisions(); + for (var alpha = 1; iterations >= 0; --iterations) { relaxLeftToRight(alpha); resolveCollisions(); + relaxRightToLeft(alpha *= .99); + resolveCollisions(); } function initializeNodeDepth() { From b7ea047d410d11499e2408e0031cfb1246fb99c1 Mon Sep 17 00:00:00 2001 From: Rioting Pacifist Date: Tue, 7 Mar 2023 11:06:52 -0800 Subject: [PATCH 2/2] re-jig improvement to look better --- _src/js/sankey.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/_src/js/sankey.js b/_src/js/sankey.js index 122d56b8..16b2e5be 100644 --- a/_src/js/sankey.js +++ b/_src/js/sankey.js @@ -163,11 +163,12 @@ d3.sankey = function() { resolveCollisions(); centerFunds(); for (var alpha = 1; iterations >= 0; --iterations) { - relaxLeftToRight(alpha); - resolveCollisions(); - relaxRightToLeft(alpha *= .99); - resolveCollisions(); + relaxLeftToRight(alpha *= .99); + relaxRightToLeft(alpha); } + centerFunds(); + relaxRightToLeft(alpha); + resolveCollisions(); function initializeNodeDepth() { var ky = d3.min(nodesByBreadth, function(nodes) {