-
Notifications
You must be signed in to change notification settings - Fork 0
/
index1.html
59 lines (40 loc) · 1.16 KB
/
index1.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
52
53
54
55
56
57
58
59
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>murder map</title>
<script type="text/javascript" src="d3.v3.js"></script>
<script src="http://d3js.org/topojson.v1.min.js"></script>
<style type="text/css">
</style>
</head>
<body>
<script type="text/javascript">
//Width and height
var w = 950;
var h = 500;
var projection = d3.geo.albersUsa()
.scale(1000)
.translate([w/2, h/2]);
//Define default path generator
var path = d3.geo.path()
.projection(projection);
//Create SVG element
var svg = d3.select("body")
.append("svg")
.attr("width", w)
.attr("height", h);
//Load in GeoJSON data
d3.json("us-states.json", function(json) {
//Bind data and create one path per GeoJSON feature
svg.selectAll("path")
.data(json.features)
.enter()
.append("path")
.attr("d", path)
.style("fill","blue")
.style("stroke","white");
});
</script>
</body>
</html>