Skip to content

Instantly share code, notes, and snippets.

Last active Jan 28, 2021
What would you like to do?
Republic of Ireland Choropleth
var data; // loaded asynchronously
//Albers projection values based on playing with ireland.json using D3's Albers Example
var proj = d3.geo.albers()
var path = d3.geo.path().projection(proj);
var svg ="#chart")
var counties = svg.append("g")
.attr("id", "ireland");
//Irish geoJSON based on
d3.json("ireland.json", function(json) {
.attr("class", "ireland")
.attr("d", path);
d3.json("road-deaths-2010.json", function(json) {
data = json;
.attr("class", quantize);
function quantize(d) {
return "q" + Math.min(8, ~~(data[] * 9 / 21)) + "-9";
<!DOCTYPE html>
svg {
background: #fff;
width: 900px;
height: 500px;
#ireland path{
stroke: #fff;
stroke-width: .25px;
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>Irish Choropleth Example</title>
<script type="text/javascript" src=""></script>
<div id="chart"></div>
<script type="text/javascript" src="choropleth.js"></script>
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment