Skip to content

Instantly share code, notes, and snippets.

@EnisBerk
Created February 19, 2014 07:57
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 EnisBerk/9087810 to your computer and use it in GitHub Desktop.
Save EnisBerk/9087810 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>D3: Setting path fills</title>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script src="http://d3js.org/topojson.v1.min.js"></script>
<style type="text/css">
/* No style rules here yet */
</style>
</head>
<body>
<script type="text/javascript">
var width = 960,
height = 1160;
var projection = d3.geo.albers()
.center([35, 35])
.rotate([0, 0])
//.parallels([50, 60])
.scale(1400*2)
.translate([width / 2, height / 2]);
var path = d3.geo.path()
.projection(projection);
var svg = d3.select("body").append("svg")
.attr("width", width)
.attr("height", height);
d3.json("tr-topo-prop.json", function(error, uk) {
svg.append("path")
.datum(topojson.feature(uk, uk.objects.tr))
.attr("d", path);
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment