block by emeeks aea3c7fc1acc0eca4d44

Styling Canvas Elements - d3.carto

Full Screen

Canvas element styling with d3.carto.map does not use d3.selectAll like SVG element styling because these aren’t SVG elements. Here we see 6000+ cities between 50k and 1m population each styled based on various attributes.

This relies on using cartoLayer.markerColor() and cartoLayer.markerSize() and setting them to function based on the data. If you don’t set markerColor, then it will rely on CSS styling of the associated class.

This example is also available in transform mode.

index.html

d3map.css