-
Notifications
You must be signed in to change notification settings - Fork 0
/
choro.html
51 lines (37 loc) · 854 Bytes
/
choro.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
49
50
51
<!DOCTYPE html>
<meta charset="utf-8">
<style>
#boroughs {
stroke: grey;
stroke-width: 2px;
fill: steelblue;
}
</style>
<script type="text/javascript" src="d3/d3.min.js"></script>
<body>
<script>
var width = 600,
height = 600;
var svg = d3.select("body").append("svg")
.attr("width", width)
.attr("height", height);
d3.json("Data/nyc.json", function(error, nyb) {
console.log(nyb)
var projection = d3.geo.mercator()
.center([-73.94, 40.70])
.scale(50000)
.translate([(width) / 2, (height)/2]);
var path = d3.geo.path()
.projection(projection);
var g = svg.append("g");
g.append("g")
.attr("id", "boroughs")
.selectAll(".state")
.data(nyb.features)
.enter().append("path")
.attr("class", function(d){ return d.properties.name; })
.attr("d", path);
});
</script>
</body>
</html>