All examples By author By category About

emeeks

Styling Canvas Elements - d3.carto

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.