Created
July 10, 2015 20:16
-
-
Save metalaureate/9fc8ffa220139497f15a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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