Skip to content

Instantly share code, notes, and snippets.

@enjalot
Last active November 2, 2015 21:36
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save enjalot/7ea44d0bc364b6bddbd8 to your computer and use it in GitHub Desktop.
The Migrant Files: Deaths
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js"></script>
<style>
body { margin:0;position:fixed;top:0;right:0;bottom:0;left:0; }
pre { width: 100%; height: 100%; font-size: 10px; overflow-y: scroll; }
</style>
</head>
<body>
<pre id="json"></pre>
<script>
function process(d) {
var processed = {
dead: +d.dead,
dead_and_missing: +d.dead_and_missing, //this seems to be most important
missing: +d.missing,
latitude: +d.latitude,
longitude: +d.longitude,
date: new Date(d.date),
description: d.description,
name: d.name,
source: d.source,
cause_of_death: d.cause_of_death,
route: d["route (Frontex)"],
Event_id: d.Event_id
}
return processed;
}
d3.csv("http://enjalot.github.io/migrants/events.csv", function(err, rawdata) {
console.log("rawdata", rawdata);
var data = rawdata.map(process);
console.log("data", data);
d3.select("#json").text(JSON.stringify(data, null, 2))
});
</script>
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment