Skip to content

Commit

Permalink
Fixes d3#91 (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
ernest-okot authored Jun 3, 2017
1 parent 4401b72 commit 416cb7c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/partition.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ export default function() {
var dx = 1,
dy = 1,
padding = 0,
round = false;
round = false,
rootDepth = null;

function partition(root) {
var n = root.height + 1;
rootDepth = root.depth;
root.x0 =
root.y0 = padding;
root.x1 = dx;
Expand All @@ -21,7 +23,7 @@ export default function() {
function positionNode(dy, n) {
return function(node) {
if (node.children) {
treemapDice(node, node.x0, dy * (node.depth + 1) / n, node.x1, dy * (node.depth + 2) / n);
treemapDice(node, node.x0, dy * (node.depth - rootDepth + 1) / n, node.x1, dy * (node.depth - rootDepth + 2) / n);
}
var x0 = node.x0,
y0 = node.y0,
Expand Down

0 comments on commit 416cb7c

Please sign in to comment.