Skip to content

Instantly share code, notes, and snippets.

@scogle
Created October 17, 2014 21:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scogle/cab5a3894a32a3122058 to your computer and use it in GitHub Desktop.
Save scogle/cab5a3894a32a3122058 to your computer and use it in GitHub Desktop.
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