-
-
Save Andrew-Reid/7edb496a7b6a51f17cbec8c3431c8551 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>D3: Setting path fills</title> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/4.10.0/d3.min.js"></script> | |
<style type="text/css"> | |
/* styles */ | |
</style> | |
</head> | |
<body> | |
<script type="text/javascript"> | |
var svg = d3.select("body").append("svg") | |
.attr("width", 760) | |
.attr("height", 700) | |
d3.json("canada.json", function(data) { | |
var group = svg.selectAll("g") | |
.data(data.features) | |
.enter() | |
.append("g") | |
var projection = d3.geoMercator(); | |
var path = d3.geoPath().projection(projection); | |
var areas = group.append("path") | |
.attr("d",path) | |
.attr("class","area") | |
}) | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment