Last active
May 5, 2019 17:29
-
-
Save FrieseWoudloper/7f8634088803206fca6330c7658bf8b8 to your computer and use it in GitHub Desktop.
Verkiezingsuitslag
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
<script src="https://d3js.org/d3.v4.min.js"></script> | |
<script src="https://unpkg.com/topojson@3"></script> | |
<div class="graph"></div> | |
<script> | |
var width = 700, height = 400; | |
var svg = d3.select(".graph").append("svg") | |
.attr("viewBox", "0 0 " + (width) + " " + (height)) | |
.style("max-width", "700px") | |
d3.json("gemeenten.json", function(error, topology) { | |
var mapdata = topojson.feature(topology, topology.objects.gemeenten); | |
var projection = d3.geoMercator(); | |
var path = d3.geoPath().projection(projection); | |
projection.fitSize([width,height],{"type": "FeatureCollection", "features": mapdata.features}) | |
svg.append("g") | |
.attr("class", "gemeente") | |
.selectAll("path") | |
.data(mapdata.features) | |
.enter() | |
.append("path") | |
.attr("d", path) | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment