I defined an empty variable dataset: var dataset = []; Load data from a .csv file by d3.dsv function, the schema likes
d3.dsv(",", "filename.csv", function(d){
return {
key1: value,
key2: value,
...
};
}).then(function(d) {
//do something like dataset = d to update dataset;
});
My goal is to update the global value dataset I defined at the beginning by .then() function, so I can use the updated dataset later, and it's outside of .then() function. What I can do to achieve my goal?