forked from tsipkens/fmviz
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtable.html
79 lines (69 loc) · 2.73 KB
/
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link href="index.css" rel="stylesheet">
<script src="https://d3js.org/d3.v4.js"></script>
</head>
<body>
<table id="tableid">
</table>
<script type="text/javascript" charset="utf-8">
d3.csv("https://raw.githubusercontent.com/tsipkens/fmviz/main/data/fm.csv", function(data) {
var content = '';
content += "<tr>";
content += '<td><b>FILTER MATERIAL</b></td>';
content += "<td><b>CODE</b></td>";
content += "<td><b># LAYERS</b></td>";
content += "<td><b>TREATMENT</b></td>";
content += "<td><b>QUALITY</b></td>";
content += "<td><b>PRESSURE <br>DROP [Pa]</b></td>";
content += "<td><b>% FILTRATION</b></td>";
content += "<td><b>% PENETRATION</b></td>";
content += "</tr>";
rowname = ' ';
data.forEach(function(row) {
if (!(row.CaseCode==rowname)) {
content += "<tr>";
content += "<td>" + row.SimpleName + "</td>";
content += "<td>" + row.CaseCode + "</td>";
content += "<td>" + row.Layers + "</td>";
if (row.Treatment=="None") {
content += "<td>-</td>";
} else if ((row.Treatment.includes("Launder"))||(row.Treatment.includes("soap"))) {
content += '<td><font color="#3498DB">' + row.Treatment + '</font></td>';
} else if (row.Treatment.includes("Heat")) {
content += '<td><font color="#FFA07A">' + row.Treatment + '</font></td>';
} else {
content += "<td>" + row.Treatment + "</td>";
}
if (row.Quality>=30) {
content += '<td><font color="#2ECC71">' + row.Quality + '</font></td>';
} else {
if (row.Quality=='#NUM!') {
content += '<td><font color="#2ECC71">→ ∞</font></td>';
} else {
content += '<td>' + row.Quality + '</td>';
}
}
if (row.PressureDrop>=55) {
content += '<td><font color="#E74C3C">' + row.PressureDrop + '</font></td>';
} else {
content += '<td>' + row.PressureDrop + '</td>';
}
if ((100 - Math.round(row.Filt9 * 100))>75) {
content += '<td><font color="#1D8348">' + (100 - Math.round(row.Filt9 * 100)) + "</font></td>";
content += '<td><font color="#1D8348">' + Math.round(row.Filt9 * 100, 1) + "</font></td>";
} else {
content += "<td>" + (100 - Math.round(row.Filt9 * 100)) + "</td>";
content += "<td>" + Math.round(row.Filt9 * 100, 1) + "</td>";
}
content += "</tr>";
}
rowname = row.CaseCode;
});
document.getElementById("tableid").innerHTML = content;
});
</script>
</body>
</html>