I need to get the result of this algorithm called cartogram. This result is asynchronous, that is why it does not work with define a global variable. I need to get the json object that generates this: "features.features".
d3.json ("mapaoriginal.topojson" function (topology) {
var = cartogram features (topology, topology.objects.collection.geometries);
d3.select ("SVG")
.attr ("width", 1000)
.attr ("height", 500)
.selectAll ("path")
.data (features.features)
.enter ()
.append ("path")
.attr ("d" cartogram.path);
})
My idea is to have something.
result = features.features;
and then use "result" outside the function. if I define a global variable, it always appears undefined. how I can get out of the function I need?