Web Development



Setting variable width on d3 tree nodes

By vomaus94 ·
I'm using d3 to create an Org Chart, which has some nodes with longer names.

I've managed to modify the width of longer nodes, but have trouble properly placing their children and the lines (paths) to their children. I tried calculating myself with determineChildXValue(), but that didn't work properly.

Is there a way to initialize the tree with variable widths so it will take care of the calculations of translations for child nodes?

Currently, I'm initializing it with hard-coded node sizes:

var tree = d3.layout.tree().nodeSize([70, 40]);
I've replicated the behavior at https://jsbin.com/yelogam/edit?html,js,output - expand Departments, then DEPARTMENT STORES to see the overlap.

Thanks in advance!

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Answers

Share your knowledge

Related Discussions

Related Forums