-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtableFunctions.js
More file actions
48 lines (42 loc) · 1.13 KB
/
Copy pathtableFunctions.js
File metadata and controls
48 lines (42 loc) · 1.13 KB
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
function tabulate(divID, data, columns) {
var table = d3.select(divID)
.selectAll(".ANN_Table")
.append("table")
.style('width','150px'),
thead = table.append("thead"),
tbody = table.append("tbody");
// append the header row
thead.append("tr")
.selectAll("th")
.data(columns)
.enter()
.append("th")
.style('text-align','center')
.text(function(column) { return column; });
// create a row for each object in the data
var rows = tbody.selectAll("tr")
.data(data)
.enter()
.append("tr")
.style('text-align','center')
.attr('id',function (d,i) {return 'data' + i;});
// create a cell in each row for each column
var cells = rows.selectAll("td")
.data(function(row) {
return columns.map(function(column) {
return {column: column, value: row[column]};
});
})
.enter()
.append("td")
.style('text-align','center')
.attr("style", "font-family: Courier;width:120px;");
return table;
}
function updateTable(c){
d3.select("#data"+c%10).selectAll("td")
.data([myData[c%10].T,
myData[c%10].HR,
myData[c%10].S_true])
.html(function(d) { return d.toFixed(2); });
}