All examples By author By category About

emeeks

Choropleth 2 - d3.carto.map

A simple choropleth map made with d3.carto.map.

After adding a tile layer and a topojson layer, you can access the features either by using map.layers() or the layer if assigned to a variable or via d3.selectAll.data() on the appropriate elements. You can then style the features based on their properties. In this case, the size of the ward.

Some hover behavior can also be defined using D3. Here we the wards in a shared region are turned semi-transparent.