1

I wanted to inc the space between nodes vertically and for that I find out that d3 have nodeSize() from v3 onward , I find out similar questions on stack and fuddles and there everything works fine. But in my case this nodeSize() is not working.

I have created a js fiddle which includes my code but d3 graph is not exactly the same as i have in my dev server bec that includes angular and js calls too but I think that will not affect this size problem . So you can get an idea what I did and why nodeSize() is not working

http://jsfiddle.net/9428byn7/

Edited :

I just find out that nodeSize is also not working in their example http://bl.ocks.org/robschmuecker/7880033

may be bec they are using viewHieght and viewWidth , any solution ?

saf
  • 259
  • 4
  • 20
  • your comment at https://gist.github.com/robschmuecker/7880033#gistcomment-1583574 makes me think this http://jsfiddle.net/9428byn7/3/ might help not real sure what you are building but you mentioned the bootbox does not work...Good luck – CrandellWS Sep 29 '15 at 14:06

1 Answers1

3

Ok if you read the document: https://github.com/mbostock/d3/wiki/Tree-Layout#size Its states clearly in the doc: The size property is exclusive with tree.nodeSize; setting tree.size sets tree.nodeSize to null.

So in your update function in the fiddle(http://jsfiddle.net/9428byn7/) check line 473: You have written:

tree = tree.size([newHeight, viewerWidth]);

Which nullifies your tree.nodeSize as per doc and as we are seeing it. so instead of doing the above line instead do:

tree.nodeSize([200,600]);

Working code here.

Hope this clarifies your concern!

Cyril Cherian
  • 32,177
  • 7
  • 46
  • 55
  • Yes , Update function too includes tree.size() , initially I searched for .size() in my file but didn't notice there are two instances of this . Anyway my mistake but thanks a lot , seriously you saved my day – saf Sep 29 '15 at 10:58