简体   繁体   English

具有嵌套单个子数组的d3js Circle Pack图

[英]d3js Circle Pack diagram with nested single child arrays

I'm building a pack diagram based on this: http://bl.ocks.org/mbostock/4063530 我正在构建一个基于此的包图: http//bl.ocks.org/mbostock/4063530

Here is a jsbin illustrating the problem. 这是一个说明问题的jsbin。 http://jsbin.com/xukufi/1/edit?js,output http://jsbin.com/xukufi/1/edit?js,output

Using the code form the example if you have nested arrays of children with a single child the bottom most child overlaps all the others, so you cannot see or interact with any of the parent objects. 如果您具有包含单个子项的子项的嵌套数组,则使用代码构成示例,最底层的子项与其他子项重叠,因此您无法查看任何父对象或与之交互。

In my jsbin I've overcome this by checking for the number of siblings and decreasing the circle radius by a third. 在我的jsbin中,我通过检查兄弟姐妹的数量并将圆半径减少三分之一来克服这个问题。 This works, but messes up the node layout if any of this single children have multiple nodes in them. 这可行,但是如果这个单个子节点中有任何节点有多个节点,则会弄乱节点布局。 I've got the radius problem figured out, but I can't figure out how to position the x and y for the circles. 我已经找到了半径问题,但我无法弄清楚如何为圆圈定位x和y。

I may be going off track at this point. 在这一点上,我可能会偏离轨道。 Has anyone else dealt with this problem with how d3 renders the circle pack? 有没有其他人处理这个问题与d3如何呈现圆形包?

Ben's link solved my problem. Ben的链接解决了我的问题。 This is indeed a duplicate. 这确实是重复的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM