-
Notifications
You must be signed in to change notification settings - Fork 4
/
oldindex.html
458 lines (419 loc) · 12.3 KB
/
oldindex.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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
<!DOCTYPE html>
<html>
<meta charset="utf-8">
<link rel="shortcut icon" href="resources/favicon.ico" />
<meta name="description" content="A light-weight data viewer for hydrologic data" />
<meta name="author" content="Martin Roberge" />
<meta name="keywords" content="HydroCloud, hydrology, stream gauges, USGS, data" />
<link href='https://fonts.googleapis.com/css?family=Vollkorn:700italic' rel='stylesheet' type='text/css'>
<title>HydroCloud hydrograph demo</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<style type="text/css">
svg {
font: 10px sans-serif;
}
.axisTitle {
font: 14px serif;
}
.Title {
font: 20px serif;
}
.subTitle {
font: 12px serif;
}
path {
stroke: lightskyblue;
fill: none;
}
path:hover {
stroke: red;
}
.axis path, .axis line {
fill: none;
stroke: #000;
shape-rendering: crispEdges;
}
.bar rect {
fill: lightskyblue;
shape-rendering: crispEdges;
}
.bar text {
fill: black;
}
.brush .extent {
stroke: #fff;
fill-opacity: .125;
shape-rendering: crispEdges;
}
</style>
<style>
html, body, #map_div {
margin: 0;
padding: 0;
height: 100%;
}
</style>
<style type="text/css">
#pull {
font-family: 'Vollkorn', serif;
font-style: italic;
font-size: 24pt;
color: white;
text-shadow: 3px 3px 10px #002;
}
header h1 {
margin: 0;
padding-left: 16px;
padding-bottom: 5px;
font-family: 'Vollkorn', serif;
font-style: italic;
font-size: 24pt;
color: white;
text-shadow: 3px 3px 10px #002;
background-color: #679;
}
footer {
height: 20px;
clear: both;
margin: 0;
padding: 0;
color: #bbb;
text-align: center;
font-size: 8pt;
}
</style>
<link rel="stylesheet" href="resources/normalize.css">
<style type="text/css">
/* Clearfix */
.clearfix:before, .clearfix:after {
content: " ";
display: table;
}
.clearfix:after {
clear: both;
}
.clearfix {
*zoom: 1;
}
/* Basic Styles */
body {
background-color: #ece8e5;
}
nav {
height: 40px;
width: 100%;
background: #455868;
font-size: 11pt;
font-family: 'PT Sans', Arial, sans-serif;
font-weight: bold;
position: relative;
border-bottom: 2px solid #283744;
}
nav ul {
padding: 0;
margin: 0 auto;
width: 700px;/*This was set to 600 to match the instructions for screens under 600px.*/
height: 40px;
}
nav li {
display: inline;
float: left;
}
nav a {
color: #fff;
display: inline-block;
width: 100px;
text-align: center;
text-decoration: none;
line-height: 40px;
text-shadow: 1px 1px 0px #283744;
}
nav li a {
border-right: 1px solid #576979;
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
}
nav li:last-child a {
border-right: 0;
}
nav a:hover, nav a:active {
background-color: #8c99a4;
}
nav a#pull {
display: none;
}
/*Styles for screen 600px and lower*/
@media screen and (max-width: 600px) {
nav {
height: auto;
}
nav ul {
width: 100%;
display: block;
height: auto;
}
nav li {
width: 50%;
float: left;
position: relative;
}
nav li a {
border-bottom: 1px solid #576979;
border-right: 1px solid #576979;
}
nav a {
text-align: left;
width: 100%;
text-indent: 25px;
}
}
/*Styles for screen 515px and lower*/
@media only screen and (max-width: 480px) {
nav {
border-bottom: 0;
}
nav ul {
display: none;
height: auto;
}
nav a#pull {
display: block;
background-color: #283744;
width: 100%;
position: relative;
}
nav a#pull:after {
content: "";
background: url('resources/nav-icon.png') no-repeat;
width: 30px;
height: 30px;
display: inline-block;
position: absolute;
right: 15px;
top: 10px;
}
#logo {
display: none;
}
}
/*Smartphone*/
@media only screen and (max-width: 320px) {
nav li {
display: block;
float: none;
width: 100%;
}
nav li a {
border-bottom: 1px solid #576979;
}
}
</style>
<link href='https://fonts.googleapis.com/css?family=PT+Sans:400,700' rel='stylesheet' type='text/css'>
<script src="lib/jquery/jquery-2.0.2.js"></script>
<script>
var viewState = "map";
function checkState() {
console.log("checkState: " + viewState);
if (viewState === "hydro") {
d3.select("svg").remove();
hydrograph("Hydrograph");
} else if (viewState === "flow") {
d3.select("svg").remove();
flowduration("Flow Duration");
} else if (viewState === "histo") {
d3.select("svg").remove();
loghistogram("Histogram");
} else {
//don't need to plot a thing if we aren't showing a graph.
}
}
$(function() {
//Menu design from Thoriq Firdaus www.hongkiat.com/blog/responsive-web-nav/
var pull = $('#pull');
menu = $('nav ul');
menuHeight = menu.height();
$(pull).on('click', function(e) {
e.preventDefault();
menu.slideToggle();
});
$(showMap).on('click', function(e) {
viewState = "map";
console.log(viewState);
d3.select("svg").remove();
document.getElementById("map_div").style.display = "block";
document.getElementById("aboutText").style.display = "none";
});
$(hydro).on('click', function(e) {
viewState = "hydro";
console.log(viewState);
d3.select("svg").remove();
document.getElementById("map_div").style.display = "none";
document.getElementById("aboutText").style.display = "none";
hydrograph("name");
});
$(flow).on('click', function(e) {
viewState = "flow";
console.log(viewState);
d3.select("svg").remove();
document.getElementById("map_div").style.display = "none";
document.getElementById("aboutText").style.display = "none";
flowduration("name");
});
$(histo).on('click', function(e) {
viewState = "histo";
console.log(viewState);
d3.select("svg").remove();
document.getElementById("map_div").style.display = "none";
document.getElementById("aboutText").style.display = "none";
loghistogram("name");
});
$(download).on('click', function(e) {
console.log("download");
dataCsv("stream");
});
$(about).on('click', function(e) {
viewState = "about";
console.log(viewState);
d3.select("svg").remove();
document.getElementById("map_div").style.display = "none";
document.getElementById("aboutText").style.display = "block";
});
$(window).resize(function() {
var w = $(window).width();
if (w > 320 && menu.is(':hidden')) {
menu.removeAttr('style');
myScreen.width = $(window).width() - 20;
myScreen.height = $(window).height() - (header + 60);
//hydrograph(id);
//checkState();
}
});
});
</script>
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCxmwq7svGGXSeaXHsxfW27LDaXytc3nBY&sensor=false"></script>
<script src="src/initialize.js"></script>
<body>
<header>
<h1 id="logo">HydroCloud</h1>
</header>
<nav class="clearfix">
<ul class="clearfix">
<li>
<a id="showMap" href="#">Map/Select</a>
</li>
<li>
<a id="hydro" href="#">Hydrograph</a>
</li>
<li>
<a id="flow" href="#">Flow Duration</a>
</li>
<li>
<a id="histo" href="#">Histogram</a>
</li>
<li>
<a id="download" href="#">Download</a>
</li>
<li>
<a id="about" href="#">About</a>
</li>
</ul>
<a href="#" id="pull">HydroCloud</a>
</nav>
<script src="lib/d3/d3.min.js"></script>
<script src="src/oldHydroGraph.js"></script>
<script>
function getUSGS(id) {
if (id == "local") {
var filename = "resources/USGSshort.txt";
} else {
var filename = "https://waterservices.usgs.gov/nwis/iv/?format=json&sites=" + id + "&period=P30D¶meterCd=00060";
}
d3.json(filename, function(error, json) {
if (error) {
if (error.status === 0) {
alert("CORS is not enabled.");
}
return console.warn(error);
}
//if (!json.value.timeSeries[0].values[0].value){console.warn("there is no data for this site")};
temp = json.value.timeSeries[0].values[0].value;
//I need to check if this even has a value!!
//MR Create a new array of objects from the JSON.
data = [];
//Clear out the array.
temp.forEach(function(d, index, array) {
d.date = new Date(d.dateTime);
d.value = +d.value;
data[index] = {
date : d.date,
value : d.value
};
});
// target.dispatchEvent(myEvent2);
//d3.select("svg").remove();
//hydrograph(id);
//flowduration(id);
//loghistogram(id);
checkState();
});
}
</script>
<div id="aboutText" style="display:none;">
<h2>Description of the HydroCloud project</h2>
<p>
HydroCloud is a hydrological analysis system consisting of a fast, lightweight mapping and analysis tool and a scalable, distributed database. This page is a partial demonstration of the interface for this project.
Martin Roberge and Michael McGuire are the principle investigators for this project, which has been generously supported with a seed grant from the TU School of Emerging Technology.
</p>
<p>
Learn more about the HydroCloud project:
</p>
<ul>
<li>
Visit our GitHub repository: <a href="https://github.com/mroberge/HydroCloud">https://github.com/mroberge/HydroCloud</a>
</li>
<li>
The Towson University <a href="https://www.towson.edu/set/Projects/HydroCloud.asp">School of Emerging Technologies</a>
</li>
</ul>
<p></p>
<p>
We've made several versions of the layout:
</p>
<ul>
<li>
<a href="https://mroberge.github.io/" >Our first app</a> This site was our first proof-of-concept and was meant for large screens and desktop analysis.
</li>
<li>
<a href="https://mroberge.github.io/HydroCloud/" >Our second app</a> We set this site up to test the feasibility of graphing data on a mobile phone. It uses the <a href="https://d3js.org/">D3 library</a> for graphing.
</li>
<li>
<a href="https://mroberge.github.io/HydroCloud/bootstraplayout.html" >Our latest app</a> This site is set up using <a href="https://getbootstrap.com/">Bootstrap</a> for the styling.
</li>
</ul>
</div>
<div id="target"></div>
<div id="map_div"></div>
<script>
/*
var myEvent = new Event("parsed");//IE doesn't let you create custom events.
var body = document.getElementById('target');
//console.log(body);
body.addEventListener("parsed", function(e) {
alert("parsed!" + e);
}, false);
var myEvent2 = new CustomEvent("parsed2", {
'detail' : "site name"
});
//everytime we load new data, it draws a hydrograph. That's not what we want anymore.
//body.addEventListener("parsed2", function (e){hydrograph(e.detail);}, false);
body.addEventListener("parsed2", function(e) {
console.log("data loaded: site " + e.detail);
}, false);
*/
var data = [];
getUSGS("01646500");
//Initial data request.
</script>
</body>
</html>