May 2019
Beginner to intermediate
650 pages
14h 50m
English
To create a choropleth we need to combine shape data, obtained from the GeoJSON file, with thematic data, usually obtained from other sources unless it's already in your Features' properties object. In this example we will load a CSV file with population, area and HDI data compiled from United Nations and World Bank public databases (See Data/un_regions.csv).
Replace the d3.json().then() block from the previous code with the following code, that uses Promise.all(). Everything should work as before.
Promise.all([ d3.json('../Data/' + FILE), // the shapes file d3.csv('../Data/un_regions.csv') // the thematic data file]).then(function([shapes, thematic]) { map.features = shapes.features; draw();});
We don't need all the ...
Read now
Unlock full access