Skip to content

Instantly share code, notes, and snippets.

@Andrew-Reid
Created November 23, 2017 05:53
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 Andrew-Reid/b9f22a3c9b18f218bcbd0df40493067d to your computer and use it in GitHub Desktop.
Save Andrew-Reid/b9f22a3c9b18f218bcbd0df40493067d to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
<!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