Created
March 10, 2015 22:28
-
-
Save fdaudens/ea0e71c961551895e391 to your computer and use it in GitHub Desktop.
D3 Nest d'un JSON
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
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