All examples By author By category About

emeeks

Small Maptiples - d3.carto

Using d3.carto.map's built-in canvas rendering and HTML5 canvas's built-in toDataUrl() function to create small multiples of the same map.

This example cycles through the various numeric attributes of the point dataset and restyles the map by changing layer.markerColor and layer.strokeColor. You have to call map.refresh() to update the display and then select the canvas element associated with the map to get access to the image data as a data URL, which you can pass to img elements.

This method of accessing toDataUrl only works with layers drawn using canvas.