Instantly share code, notes, and snippets.

Embed
What would you like to do?
Recursively convert flat data to the nested flare format
var root = d3z.toFlareRecursive({
data: json,
parentKey: 'superClass',
childKey: 'thisClass',
nameKey: function(obj){
var prefix = obj['thisClass'].match(/\/([a-zA-Z_]*)\#/)[1],
name = obj['thisClass'].match(/\#(.*)>/)[1];
return prefix + ":" + name;
},
sizeKey: function(obj){
var size = obj.instance + 4.5 || 4.5;
return size;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment