There is something I don't understand with d3. Let's say you have a json file, you're loading it like this :
var url = 'http://localhost:5000/authors';
d3.json('http://url.com', function(data) {
nestedData(data);
});
then you have your function like this :
var nestedData = function(data) {
d3.nest()
.key(function(d) { return d.stuff;})
.rollup(function(d) { return d3.sum(d, function(g) {return g.otherstuff;}); })
.entries(data);
}
If I have understood well the principle of the callback function, my function "nedtedData" will be executed, only once data are loaded. How can I retrieve the data inside my function named "nestedData ? Let's say I want to push the data into a empty variable (var newdata = []) ?
My main concern with this is to try to understand asynchronous callback and data set behaviors.