Skip to content

Instantly share code, notes, and snippets.

@yosiasz
Created April 24, 2016 00:12
Show Gist options
  • Save yosiasz/7b898b0abc180c430bca60a0db2941ab to your computer and use it in GitHub Desktop.
Save yosiasz/7b898b0abc180c430bca60a0db2941ab to your computer and use it in GitHub Desktop.
fresh block
<!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; }
svg { width:100%; height: 100% }
</style>
</head>
<body>
<script>
var width = 960,
height = 500;
var path = d3.geo.path();
var svg = d3.select("body").append("svg")
.attr("width", width)
.attr("height", height);
d3.json("../data/ethiopia.json", function(error, topology) {
if (error) throw error;
console.log(topology);
svg.selectAll("path")
.data(topojson.feature(topology, topology.objects.regions).features)
.enter().append("path")
.attr("d", path);
});
</script>
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment