# kartograph-js

> JavaScript library for SVG mapping

Latest version **0.8.7** (published 2014-05-15) · 0 weekly downloads

## Install

```sh
npm install kartograph-js
pnpm add kartograph-js
yarn add kartograph-js
bun add kartograph-js
```

## Health

**Score 10/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; low quality score; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.8.7 |
| Published | 2014-05-15 |
| First published | 2013-03-20 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 (+4 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 1495 |
| Author | Gregor Aisch |
| Maintainers | gka |
| Keywords | svg, map, raphael |

## Links

- npm: https://www.npmjs.com/package/kartograph-js
- Repository: https://github.com/kartograph/kartograph.js
- Homepage: http://kartograph.org
- Issues: https://github.com/kartograph/kartograph.js/issues
- npm.io page: https://npm.io/package/kartograph-js

## Dependencies (2)

- [jquery](https://npm.io/package/jquery.md) 1.x
- [raphael](https://npm.io/package/raphael.md) 2.x

## Recent versions

- 0.8.7 (latest) — 2014-05-15
- 0.8.5 — 2014-03-27
- 0.8.4 — 2014-03-27
- 0.6.1 — 2013-03-20

## README

# Kartograph.js

Kartograph.js is a JavaScript library that renders [SVG maps](https://github.com/kartograph/kartograph.py/) in web browsers. It is built on top of [jQuery](http://jquery.com) and [RaphaelJS](http://raphaeljs.com). Please have a look at the [API docs](https://github.com/kartograph/kartograph.js/wiki/API) for more details. 

Initializing a new map

````javascript
map = $K.map('#map', 600, 400);
map.loadMap('world.svg', function() {
	map.addLayer('countries', {
		styles: {
			fill: '#ee9900'
		},
		title: function(d) {
			return d.countryName;
		}
	});
});
```

Choropleth maps (aka coloring map polygons based on data):

```javascript
pop_density = { 'USA': 123455, 'CAN': 232323, ... };

colorscale = new chroma.ColorScale({
	colors: chroma.brewer.YlOrRd,
	limits: chroma.limits(chroma.analyze(pop_density), 'k-means', 9)
});

map.getLayer('countries').style('fill', function(data) {
	return colorscale.get(pop_density[data.iso]);
});
```

Adding symbols is easy, too:

```javascript
cities = [{ lat: 43, lon: -75, label: 'New York', population: 19465197 }];

map.addSymbols({
	data: cities,
	location: function(d) {
		return [d.lon, d.lat];
	},
	type: Kartograph.Bubble,
	radius: function(d) {
		return Math.sqrt(d.population) * 0.001;
	}
})
```

### Author

Kartograph was created by [Gregor Aisch](http://github.com/gka/). It is supported by [Piwik Web Analytics](http://piwik.org) and the [Open Knowledge Foundation](http://okfn.org).

### License

Kartograph.js is licensed under [LGPL](http://www.gnu.org/licenses/lgpl-3.0.txt)

---
_Source: https://npm.io/package/kartograph-js · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
