Skip to content

Commit

Permalink
Favor vertical partition of squares.
Browse files Browse the repository at this point in the history
With a square layout, this tends to form an initial row across the top rather
than a column along the left. Related #71.
  • Loading branch information
mbostock committed Mar 2, 2017
1 parent 3c9c4e6 commit 2c6c855
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/treemap/binary.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ export default function(parent, x0, y0, x1, y1) {
var valueLeft = sums[k] - valueOffset,
valueRight = value - valueLeft;

if ((y1 - y0) > (x1 - x0)) {
var yk = (y0 * valueRight + y1 * valueLeft) / value;
partition(i, k, valueLeft, x0, y0, x1, yk);
partition(k, j, valueRight, x0, yk, x1, y1);
} else {
if ((x1 - x0) > (y1 - y0)) {
var xk = (x0 * valueRight + x1 * valueLeft) / value;
partition(i, k, valueLeft, x0, y0, xk, y1);
partition(k, j, valueRight, xk, y0, x1, y1);
} else {
var yk = (y0 * valueRight + y1 * valueLeft) / value;
partition(i, k, valueLeft, x0, y0, x1, yk);
partition(k, j, valueRight, x0, yk, x1, y1);
}
}
}

0 comments on commit 2c6c855

Please sign in to comment.