rainerborene / map

Simple abstraction to work with SVG based maps

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Map

Simple abstraction to work with SVG based maps.

js map component

Example

var map = new Map(svg);

map.colors("#0B486B", "#3B8686", "#79BD9A");
map.set('minas-gerais', 300);
map.set('sao-paulo', 500);
map.colorize();

document.body.appendChild(map.el);

API

Map(svg)

Initialize Map with given Document.

Note: All paths must be named on your SVG document through the id attribute.

Map#size(width, height)

Set width and height dimensions.

Map#scale(amount)

Adds scale by given amount to each path.

Map#style(attributes)

Set the attributes for all paths.

Map#find(id)

Find path with given id.

Map#set(key, value)

Set value for key.

Map#colors(colors)

Set range of colors.

Map#colorize([animate])

Update fill color of each path, animation disabled by default.

Map#draw

Draw on el. Useful if you have changed colors or size values.

License

MIT

About

Simple abstraction to work with SVG based maps


Languages

Language:JavaScript 100.0%