Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How collapse nodes on start? #12

Open
homlett opened this issue Dec 11, 2014 · 1 comment
Open

How collapse nodes on start? #12

homlett opened this issue Dec 11, 2014 · 1 comment

Comments

@homlett
Copy link

homlett commented Dec 11, 2014

I would like collapse all nodes (or just some selected nodes if it's possible through a declaration in the json file for example) when the graph is loaded.

Unfortunatly, I have no idea how to do that...

@foxglove1028
Copy link

Hi @homlett, I'm not sure if you have already figured it out but to have the nodes initially collapsed when you first load the flower you would have to have a separate function that you would call AFTER you call the update function.

Within the CodeFlower.js you would have to add a new function to iterate through the nodes. In order to do that you would have to make the var nodes to be this.nodes so that you can access that information in the new function collapseNodes.

CodeFlower.prototype.collapseNode = function() {
for(var i = 0; i < this.nodes.length; i++) {
var d = this.nodes[i];
if(d.name !== "root") {
d._children = d.children;
d.children = null;
}
}
this.update();
return;
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants