humanbeing
humanbeing

Reputation: 1697

Add scrollbar to d3.layout.tree()

I am trying to make a tree like this http://mbostock.github.io/d3/talk/20111018/tree.html

And have the scrollbar on the side. I have a large tree, and it fills up more than I need of the screen or the data is too scrunched up to see.

Is there a way to set a scroll bar for an SVG view coming from d3.js? I know the intent is that it resizes, but if it all fits on the screen the information is too desn

Upvotes: 2

Views: 5005

Answers (1)

CrandellWS
CrandellWS

Reputation: 2804

Short answer may not be best but here you can see it done using your referenced repository I created this Gist https://gist.github.com/CrandellWS/ca7e6626c9e6b1413963

which can be viewed at http://bl.ocks.org/CrandellWS/ca7e6626c9e6b1413963

Basically the answer comes from https://stackoverflow.com/a/11449016/1815624

Where it says to apply overflow:scoll to the containing div of the svg that is bigger.

Hope this helps, for a more robust solution checkout this Gist http://gist.github.com/robschmuecker/7880033 and here's that bl.ocks.org link http://bl.ocks.org/robschmuecker/7880033

Upvotes: 3

Related Questions