See http://jsbin.com/okUxAvE/28 . Then click query. Notice how the children begin to appear on the level query. Now pan to methods(child query) and click on it to expand it. Please note that children methodexpand differently, almost from the center. It is like behavior when there are no more children.
How can I make these children expand just like the children from queryexpand?
I am sure that the problem is in the following code (I think), but I still cannot find the culprit. I just don’t see what the last set of children will look like.
var nodes = tree.nodes(root).reverse(),
links = tree.links(nodes);
nodes.forEach(function(d) {
if(d.parent){
for(var i = 0; i < d.parent.children.length; i++){
if(d.parent.children[i].name == d.name){
d.yOffset = i;
d.parentYoffset = d.parent.yOffset;
}
}
}
if(d.yOffset === undefined){ d.yOffset = 0; }
if(d.parentYoffset === undefined){ d.parentYoffset = 0; }
d.x = (d.yOffset * 40) + (d.parentYoffset * 40) + 20;
d.y = d.depth * 200;
});
source
share