Reputation: 4304
Is there a way to set the horizontal distance for the first level of parent and child nodes? At the moment, the distance betwenn those first level nodes to far, I would like to reduce this, but keep the distance between later levels the same as now.
// Normalize for fixed-depth.
nodes.forEach( function ( d ) {
d.y = d.depth * 250;
} );
nodes.forEach( function ( d ) {
( d.depth === 1 ) ? d.y = d.depth * 200: d.y = d.depth * 290;
} );
Upvotes: 1
Views: 424
Reputation: 7210
In your fiddle, modify the code in update function:
// Normalize for fixed-depth.
nodes.forEach(function(d) {
d.y = (d.depth === 0 ? 50 : d.depth * 200);
});
Upvotes: 3