This's my first attempt to use d3 for web maps and I faced weird problem even though I literally copied the same source code. However, the map won't load I don't know if the problem from the data or there's something wrong in the code. Hope someone can figure it out !!
This's the code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>D3 Test</title>
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
</head>
<body>
<script type="text/javascript">
d3.select("body").append("p").text("new paragraph!");
var svg = d3.select("body").append("svg")
.attr("width", 960)
.attr("height",1160)
d3.json("usa.geojson", function (data) {
var group = svg.selectAll("g")
.data(data.features)
.enter()
.append("g")
var projection = d3.geo.mercator();
var path = d3.geo.path().projection(projection);
var areas = group.append("path")
.attr("d",path)
.attr("class", "area")
.attr("fill", "steelblue")
});
</script>
</body>
The geojson file:
{
"type": "FeatureCollection",
"features": [
{ "type": "Feature",
"properties": { "GEO_ID": "0400000US23", "STATE": "23", "NAME": "Maine",
"LSAD": "", "CENSUSAREA": 30842.923000 },
"geometry": { "type": "MultiPolygon", "coordinates":