March 2017
Beginner to intermediate
868 pages
18h 52m
English
Although this globe is quite impressive for the amount of code used to create it, it feels a little dull. Let's differentiate the countries a little more, and also add the lines of latitude and longitude.
We can color the countries on the globe using a d3.scale.category20() color scale. But we can't simply rotate through the colors, as there will be cases where adjacent countries will be filled with the same color.
To avoid this, we will take advantage of another function of TopoJSON, topojson.neighbors(). This function will return, given a set of geometries (like the countries), a data structure that identifies which geometries are adjacent to each other. We can then utilize this data to prevent ...
Read now
Unlock full access