forked from birbjam/futres-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbrowse.html
178 lines (149 loc) · 6.08 KB
/
browse.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Local CSS -->
<link rel="stylesheet" href="assets/css/main.css">
<link rel="stylesheet" href="assets/css/browse.css">
<!-- Chart Js -->
<script src="https://cdn.jsdelivr.net/npm/chart.js@2.8.0"></script>
<title>FuTRES Data Portal</title>
</head>
<body>
<header class="header">
<h1 class="logo">FuTRES Data Portal</h1>
<nav>
<ul class="nav-links">
<li><a id="query-nav" href="query.html">Query</a></li>
<li><a id="browse-nav" class="nav-btn" href="browse.html">Browse</a></li>
<li><a id="home-nav" href="index.html">Home</a></li>
</ul>
</nav>
</header>
<div id="browse-tab">
<h2 class="page-h">Browse Data Visualization</h2>
<h2 class="collapsible-button">Charts</h2>
<div id="chart-wrapper" class="collapse-content">
<div id="chart-selects-container">
<select name="chart-select" id="chart-select">
<option value="">- Select a Chart -</option>
<option value="country">Countries</option>
<option value="measurement-type">Measurement Type</option>
<option value="year-collected">Year Collected</option>
<option value="species">Species Collected</option>
</select> <br>
</div> <!--chart select container-->
<div id="chart-container">
<canvas id="dataChart" width="800" height="650"></canvas>
</div>
</div> <!-- chart wrapper -->
<h2 class="collapsible-button">Projects</h2>
<div id="projects-wrapper" class="collapse-content">
<div id="proj-table-container">
<table id="project-table">
<thead>
<tr class="no-hover">
<th>Project Title</th>
<th>Principal Investigator</th>
<th>PI Affiliation</th>
<th>Number of Measurements</th>
</tr>
</thead>
</table>
</div>
</div> <!--projects wrapper-->
<h2 class="collapsible-button">Summary Tables</h2>
<div id="tables-wrapper" class="collapse-content">
<div id="year-table-container">
<table id="year-table">
<tr class="no-hover">
<th class="ascending" onclick="sortTable('year-table', 0)">Year Collected</th>
<th class="ascending" onclick="sortTable('year-table', 1)">Count</th>
</tr>
</table>
</div>
<div id="species-table-container">
<table id="species-table">
<tr class="no-hover">
<th class="ascending" onclick="sortTable('species-table', 0)">Species</th>
<th class="ascending" onclick="sortTable('species-table', 1)">Count</th>
</tr>
</table>
</div>
<div id="country-table-container">
<table id="country-table">
<tr class="no-hover">
<th class="ascending" onclick="sortTable('country-table', 0)">Country</th>
<th class="ascending" onclick="sortTable('country-table', 1)">Count</th>
</tr>
</table>
</div>
<div id="measure-table-container">
<table id="measure-table">
<tr class="no-hover">
<th class="ascending" onclick="sortTable('measure-table', 0)">Measurement Type</th>
<th class="ascending" onclick="sortTable('measure-table', 1)">Count</th>
</tr>
</table>
</div>
</div> <!--tables wrapper-->
<!-- The Modal -->
<div id="detail-modal" class="modal">
<div class="modal-content">
<span class="close">×</span>
<div id="modal-table-container">
</div>
</div> <!--modal content-->
</div> <!--modal -->
</div> <!-- browse tab-->
<div id="project-detail-container" style="display: none;">
<div id="project-detail">
<h1>Hi there</h1>
</div>
</div> <!-- project detail container -->
<script>
function sortTable(tableId, n) {
let table, rows, switching, i, x, y, shouldSwitch, dir, switchcount = 0;
table = document.getElementById(tableId);
switching = true;
dir = "asc";
while (switching) {
switching = false;
rows = table.getElementsByTagName("TR");
for (i = 1; i < (rows.length - 1); i++) {
shouldSwitch = false;
x = rows[i].getElementsByTagName("TD")[n];
y = rows[i + 1].getElementsByTagName("TD")[n];
let cmpX=isNaN(parseInt(x.innerHTML))?x.innerHTML.toLowerCase():parseInt(x.innerHTML);
let cmpY=isNaN(parseInt(y.innerHTML))?y.innerHTML.toLowerCase():parseInt(y.innerHTML);
cmpX=(cmpX=='-')?0:cmpX;
cmpY=(cmpY=='-')?0:cmpY;
if (dir == "asc") {
if (cmpX > cmpY) {
shouldSwitch= true;
break;
}
} else if (dir == "desc") {
if (cmpX < cmpY) {
shouldSwitch= true;
break;
}
}
}
if (shouldSwitch) {
rows[i].parentNode.insertBefore(rows[i + 1], rows[i]);
switching = true;
switchcount ++;
} else {
if (switchcount == 0 && dir == "asc") {
dir = "desc";
switching = true;
}
}
}
}
</script>
<script type="text/javascript" src="assets/js/browse.js"></script>
</body>
</html>