Skip to content

Instantly share code, notes, and snippets.

@fdaudens
Created March 10, 2015 22:28
Show Gist options
  • Save fdaudens/ea0e71c961551895e391 to your computer and use it in GitHub Desktop.
Save fdaudens/ea0e71c961551895e391 to your computer and use it in GitHub Desktop.
D3 Nest d'un JSON
d3.json("flare.json", function(root) {
var nested_data = d3.nest()
.key(function(d) { return d.Continent; })
.key(function(d) { return d.Pays; })
.key(function(d) { return d.Name; })
.key(function(d) { return d.Net_Worth; })
.entries(root);
var root_data = {};
// Add the data to the tree
root_data.key = "Sommaire";
root_data.values = nested_data;
root_data = reSortRoot(root_data,"Net_Worth");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment