IvanSanchez / Leaflet.Marker.Stack

A client-side implementation of CartoDB's "stacked chips" symbolizer
43 stars 5 forks source link

L.Marker.Stack & L.Icon.Chip

A client-side implementation of @CartoDB's idea of a stacked chips symbolizer.

Image of a few chip stacks with random data

This is composed of two parts:

L.Marker.Stack reference

Behaves like a L.Marker, but has the following options:

L.Icon.Chip reference

Behaves like a L.DivIcon, but has the following extra options:

Example

var stack = L.marker.stack(myCenter, {
    icons: [
        L.icon.chip({ color: 'red' }),
        L.icon.chip({ color: 'red' }),
        L.icon.chip({ color: 'blue' }),
        L.icon.chip({ color: 'lime' }),
    ],
    stackOffset: [0, -5]
});

map.addLayer(stack);

Check out the live demos:

Legalese

"THE BEER-WARE LICENSE": ivan@sanchezortega.es wrote this file. As long as you retain this notice you can do whatever you want with this stuff. If we meet some day, and you think this stuff is worth it, you can buy me a beer in return.