0

I'm building a a collapsible tree in d3 based on the tried and true Reingold-Tilford algorithm tree with the flare.json data.

you can see it here on one of my otherwise unused domain names: http://www.irreduciblecomplexity.co/

As you can see, it's getting awfully tall, and I'd like to move some of the branches to go outward from the left side instead of all from the right.

I'm not clear on how to do this, though.

http://bl.ocks.org/mbostock/3184089

This seems to be most on point, but I don't know how to replicate stemming from a single root. Any help is most appreciated.

(Also, this: Collapsible tree with combined horizontal and vertical layouts)

Thanks!

Community
  • 1
  • 1
  • To clarify, you want it so that some branches will go to the left and some branches will go to the right, but the root node should stay centered in the middle? How does the tree discern what nodes go left or right? – aug Jul 31 '15 at 18:40
  • Yes, some go to the right and some to the left and root stays in the middle. Thanks for asking! I'll probably add a "wing": "left" and "wing": "right" to the JSON for the first generation of childlen (coming straight from the root). – Patrick Horner Jul 31 '15 at 18:43
  • unfortunately that requires a lot of custom coding and you have to be very specific about the logic. How many should go left and how many should go right? Does it matter? The thing about d3.js is it draws the tree based on two factors -- breadth and depth. Doing custom layouts with the tree requires you to be very specific of how the orientation has to be. I had a [similar question](http://stackoverflow.com/questions/18108960/d3-tree-layout-custom-vertical-layout-when-children-exceed-more-than-a-certain) regarding custom layouts and it got messy. – aug Jul 31 '15 at 18:50
  • Also if you look in the example from mbostock, its not exactly the same -- he's simply showing different ways of drawing the tree, but the root node inevitably is the still at the "top" and not in the middle. – aug Jul 31 '15 at 18:51
  • Yeah. I feel like I could do one of two things: 1 - assign first generation children to "left" and "right," and then have the sign reversed for the depth for "left" and subsequent children (and adjust the labels, etc) 2 - break the data set into two parts coming from the same root using the mbostock example. – Patrick Horner Jul 31 '15 at 19:02

0 Answers0