Skip to content

Instantly share code, notes, and snippets.

@cjauvin
Last active December 10, 2015 00:19
Show Gist options
  • Save cjauvin/4350248 to your computer and use it in GitHub Desktop.
Save cjauvin/4350248 to your computer and use it in GitHub Desktop.
function collapseNodes(d) {
if (d._children) {
for (var i = 0; i < d._children.length; i++) {
collapseNodes(d._children[i])
}
}
d.children = null
d.has_matched = false;
update(d);
}
d3.json("flare.json", function(json) {
json.x0 = 0;
json.y0 = 0;
update(root = json);
vis.selectAll("g.node").each(function(d) {
d._children = d.children;
d.has_matched = false;
d.name_lower = d.name.toLowerCase();
});
collapseNodes(root);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment