-
-
Save Andrew-Reid/b9f22a3c9b18f218bcbd0df40493067d 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.geoIdentity() | |
.reflectY(true) | |
.fitSize([760,700],data); | |
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