The first d3 map I tried to make with data I made from Natural Earth stuff basically trying to apply mbostocks Let's make a map tutorial to do my own thing.
Go giants!
xxxxxxxxxx
<meta charset="utf-8">
<style>
/* CSS goes here. */
.casubun.US { fill: black; }
</style>
<body>
<script src="https://d3js.org/d3.v3.min.js"></script>
<script src="https://d3js.org/topojson.v0.min.js"></script>
<script>
/* JavaScript goes here. */
var width = 960,
height = 1000;
var projection = d3.geo.mercator()
.scale(2500)
.translate([width / 2, height / 2])
.center([-120,35])
;
var path = d3.geo.path()
.projection(projection);
var svg = d3.select("body").append("svg")
.attr("width", width)
.attr("height", height);
d3.json("cali.json", function(cali) {
svg.selectAll(".casubun")
.data(topojson.object(cali, cali.objects.casubun).geometries)
.enter().append("path")
.attr("class", function(d) { return "casubun " + d.id; })
.attr("d", path);
});
d3.select("body").transition()
.style("background-color", "#FB5B1F");
svg.selectAll(".casubun")
.data(topojson.object(cali, cali.objects.casubun).geometries)
.enter().append("path")
.attr("class", function(d) { return "casubun " + d.id; })
.attr("d", path);
</script>
</body>
Modified http://d3js.org/d3.v3.min.js to a secure url
Modified http://d3js.org/topojson.v0.min.js to a secure url
https://d3js.org/d3.v3.min.js
https://d3js.org/topojson.v0.min.js