-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathindex.html
48 lines (42 loc) · 1.13 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<!DOCTYPE html>
<html lang="en">
<head>
<title>Maptime AMS #4: Geopolitics, Borders & D3.js!</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
<script src="http://d3js.org/topojson.v1.min.js"></script>
<style>
* {
margin: 0;
padding: 0;
}
svg {
position: absolute;
width: 100%;
height: 100%;
}
</style>
</head>
<body>
<svg>
<g id="states"></g>
</svg>
<h1>United States in <span id="year">1790</span></h1>
<script>
var svgStates = d3.select("svg #states");
var projection = d3.geo.albersUsa();
var path = d3.geo.path()
.projection(projection);
d3.json("../../data/states.json", function(error, topologies) {
var state = topojson.feature(topologies[0], topologies[0].objects.stdin);
svgStates.selectAll("path")
.data(state.features)
.enter()
.append("path")
.attr("d", path);
});
</script>
</body>
</html>