Skip to content

Instantly share code, notes, and snippets.

@aydos aydos/index.html
Last active May 28, 2016

What would you like to do?
<!DOCTYPE html>
<meta charset="utf-8">
text {
font-family: helvetica, arial, sans-serif;
font-size: 10px;
text-anchor: middle;
color: #111;
<svg width="960" height="500"></svg>
<script src=""></script>
<script src=""></script>
var svg ="svg")
var sw = +svg.attr("width")
var sh = +svg.attr("height")
var projection = d3.geo.mercator()
var path = d3.geo.path()
d3.json("turkiye.json", function(error, turkiye) {
if (error) return console.error(error)
iller = topojson.feature(turkiye,
.attr("d", path)
.style("stroke", "#111")
.style("stroke-width", "4px")
.style("stroke-linejoin", "round")
.attr("fill", function(d) {return d3.hsl(198+Math.random()*4, 0.7+Math.random()*0.2, 0.4+Math.random()*0.2)})
.attr("d", path)
.datum(topojson.mesh(turkiye,, function(a, b) { return a !== b }))
.attr("d", path)
.attr("fill", "none")
.style("stroke", "#FFF")
.style("stroke-width", "2px")
.style("stroke-linejoin", "round")
.text(function(d) { return })
.attr("transform", function(d) { return "translate("+ path.centroid(d).toString() +")" })
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
You can’t perform that action at this time.