Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Japan's geojson and D3 code.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
<!DOCTYPE html>
<meta charset="utf-8">
<script src=""></script>
var width = 960,
height = 700;
var svg ="body").append("svg")
.attr("width", width)
.attr("height", height);
var xym = d3.geo.albers();
var path = d3.geo.path().projection(xym);
xym.origin([134, 25])
xym.translate([350, 745])
xym.parallels([24.6, 43.6])
d3.json("japan.json", function(data) {
.attr("d", path)
.style("fill", function() { return "#44aaee" })
.on("mouseover", function(e){"fill", "#5522aa")})
.on("mouseout", function(e){"fill", "#44aaee")})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment