2

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

humanbeing
  • 1,617
  • 3
  • 17
  • 30
  • This questions already seems to be answered here: http://stackoverflow.com/questions/29869603/creating-scrollbars-with-svg-and-d3-js – codePrady Sep 24 '15 at 23:01
  • I am not seeing anything in the API for that but it may be there it is a large API, and untill your question I did not know of d3. Thanks for asking – CrandellWS Sep 24 '15 at 23:24
  • My answer http://stackoverflow.com/a/32772481/1815624 is rudimentary, for a more robust solution checkout this Gist https://gist.github.com/robschmuecker/7880033 and here's that bl.ocks.org link http://bl.ocks.org/robschmuecker/7880033 – CrandellWS Sep 29 '15 at 12:55

1 Answers1

3

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

Community
  • 1
  • 1
CrandellWS
  • 2,708
  • 5
  • 49
  • 111