D3
OG
Old school D3 from simpler times
All examples
By author
By category
About
clayzermk1
Full window
Github gist
Mercator Projection
<!DOCTYPE html> <meta charset="utf-8"> <title>Mercator Projection</title> <style> path { fill: #ccc; stroke: #fff; } </style> <svg width="960" height="500"></svg> <script src="https://d3js.org/d3.v2.js?2.9.1"></script> <script> d3.json("readme.json", function(collection) { d3.select("svg").selectAll("path") .data(collection.features) .enter().append("path") .attr("d", d3.geo.path().projection(d3.geo.mercator())) .style("fill", function(d) { return '#'+Math.floor(d.properties.name.charCodeAt(0)/100*4620980).toString(16); }); }); </script>
Modified
http://d3js.org/d3.v2.js?2.9.1
to a secure url
https://d3js.org/d3.v2.js?2.9.1