Skip to content

Instantly share code, notes, and snippets.

@carsten-j
Created June 21, 2014 16:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save carsten-j/ddc9bf7e7c92bc6c1065 to your computer and use it in GitHub Desktop.
Save carsten-j/ddc9bf7e7c92bc6c1065 to your computer and use it in GitHub Desktop.
verdenskort2
<script src="http://d3js.org/d3.v3.min.js"></script>
<script src="http://d3js.org/topojson.v1.min.js"></script>
<script src="http://datamaps.github.io/scripts/datamaps.world.min.js?v=1"></script>
<div id="container"></div>
<script>
var basic_choropleth = new Datamap({
element: document.getElementById("container"),
projection: 'mercator',
fills: {
defaultFill: "#ABDDA4",
authorHasTraveledTo: "#fa0fa0"
},
data: {
USA: { fillKey: "authorHasTraveledTo" },
JPN: { fillKey: "authorHasTraveledTo" },
ITA: { fillKey: "authorHasTraveledTo" },
CRI: { fillKey: "authorHasTraveledTo" },
KOR: { fillKey: "authorHasTraveledTo" },
DEU: { fillKey: "authorHasTraveledTo" },
}
});
var colors = d3.scale.category10();
window.setInterval(function() {
basic_choropleth.updateChoropleth({
USA: colors(Math.random() * 10),
RUS: colors(Math.random() * 100),
AUS: { fillKey: 'authorHasTraveledTo' },
BRA: colors(Math.random() * 50),
CAN: colors(Math.random() * 50),
ZAF: colors(Math.random() * 50),
IND: colors(Math.random() * 50),
});
}, 2000);
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment