Skip to content

Instantly share code, notes, and snippets.

@markmarkoh markmarkoh/index.html forked from pachevalier/datamaps.html
Last active Aug 29, 2015

What would you like to do?
Datamaps with custom data and custom projection
<!DOCTYPE html>
<meta charset="utf-8">
<script src=""></script>
<script src=""></script>
<script src=""></script>
<div id="container" style="position: relative; width: 500px; height: 300px;"></div>
var map = new Datamap({
element: document.getElementById('container'),
geographyConfig: {
dataUrl: 'mx_states.json'
scope: "states",
setProjection: function(element, options) {
var projection = d3.geo.equirectangular()
.center([-97, 25])
.rotate([4.4, 0])
.translate([element.offsetWidth / 2, element.offsetHeight / 2]);
var path = d3.geo.path()
return {path: path, projection: projection};
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.