Skip to content

Instantly share code, notes, and snippets.

@metalaureate
Created July 10, 2015 20:16
Show Gist options
  • Save metalaureate/9fc8ffa220139497f15a to your computer and use it in GitHub Desktop.
Save metalaureate/9fc8ffa220139497f15a to your computer and use it in GitHub Desktop.
var d3tree = Convert(tree, 0, []);
var lineage = [];
function Convert(obj_to_convert, level, lineage) {
var new_obj = [];
delete obj_to_convert['null'];
console.log('level', level);
level++;
for (var i in obj_to_convert) {
lineage.push(_.findWhere(scope.persona.ids, {id_uuid: i}).id_name);
new_obj.push({
name: lineage.join(','),
size: (6 - level) * 500,
children: Convert(obj_to_convert[i], level, lineage)
});
}
lineage = [];
level--;
return (new_obj.length > 0) ? new_obj : null;
};
var root = {
"name": "Parent 1", "size": 1000,
"children": d3tree
}
$log.debug('d3tree', root);
renderBubbles(root);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment