-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtable.html
36 lines (32 loc) · 810 Bytes
/
table.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>CS171 Homework 1</title>
<style type="text/css">
/* YOUR CSS */
</style>
</head>
<body>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script>
d3.tsv("unemp_states_us_nov_2013.tsv", function(error, data){
var table = d3.select("body").append("table"),
tbody = table.append("tbody");
var rows = tbody.selectAll("tr")
.data(data)
.enter()
.append("tr");
var cells = rows.selectAll("td")
.data(function(row) {
return d3.range(Object.keys(row).length).map(function(column, i) {
return row[Object.keys(row)[i]];
});
})
.enter()
.append("td")
.text(function(d) { return d; });
});
</script>
</body>
</html>