D3 tree vertical separation

前端 未结 4 535
时光说笑
时光说笑 2020-12-30 08:03

I am using the D3 tree layout, such as this one: http://mbostock.github.com/d3/talk/20111018/tree.html

I have modified it for my needs and am running into an issue.

4条回答
  •  渐次进展
    2020-12-30 08:43

    The original fix you proposed will work, you just have to make sure you do it after you add everything to the canvas. d3 recalculates the layout each time you enter, exit, append, etc. Once you've done all that, then you can fiddle with the d.y to fix the depth.

    nodes.forEach(function(d) { d.y = d.depth * fixdepth});
    

提交回复
热议问题