-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
917 lines (825 loc) · 54.5 KB
/
index.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
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
<!DOCTYPE html>
<html>
<head lang="en">
<!-- updated 4/11/17 12:27pm - removed old logo, header/footer style. K.Koch -->
<meta charset="UTF-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Maumee Trib Tool Test</title>
<link rel="StyleSheet" href="tribtool.css" type="text/css">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script src="https://code.jquery.com/ui/1.11.4/jquery-ui.min.js"></script>
<link rel="StyleSheet" href="https://code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css" type="text/css">
<script src="http://code.highcharts.com/highcharts.js"></script>
<script src="data2.js"></script>
<script src="climatology.js"></script>
<script>
var TpOutput = 0; //Used to check if current TP cumulative loads have been written to html
var DrpOutput = 0; //Used to check if current TP cumulative loads have been written to html
function loadData() {
var tp = new Array();
var drp = new Array();
for (i = 0; i < dailyData.length; i++) {
var date = new Date(Date.parse(dailyData[i][0]));
tp[i] = [date, Math.round(10000 * dailyData[i][1]) / 10000];
drp[i] = [date, dailyData[i][2]];
}
return [["TP", tp], ["DRP", drp]];
}
function loadPlotData(data, dataset, startDay,lastDate) {
var currentYear = lastDate.getFullYear();
var aYear = grabAYear(data[dataset][1], 1, startDay, currentYear, true);
var years = [];
for (y = 2000; y < currentYear; y++) {
years.push(grabAYear(data[dataset][1], 1, startDay, y, true))
}
var stats = generateStats(data[dataset][1], 1, startDay, true);
var stats2 = generateStats(data[dataset][1], 1, startDay, false);
var d1 = [];
var d2 = [];
var d3 = [];
var d4 = [];
var d5 = [];
var d6 = [];
var d7 = [];
var f1 = [];
var f2 = [];
var f3 = [];
var f4 = [];
var f5 = [];
var dMany = new Array(15);
for (y = 2000; y < currentYear; y++) {
dMany[y - 2000] = [];
}
//Calculate Day of Year of most recent date
var timestmp = new Date().setFullYear(currentYear, 0, 1);
var yearFirstDay = Math.floor(timestmp / 86400000);
var today = Math.ceil((lastDate.getTime()) / 86400000);
var dayOfYear = today - yearFirstDay;
for (i = 0; i < 365; i++) {
date = Date.UTC(1970, 0, i + startDay);
d1.push([date, stats[4][i] - stats[3][i]]);
d2.push([date, stats[3][i] - stats[2][i]]);
d3.push([date, stats[2][i] - stats[1][i]]);
d4.push([date, stats[1][i] - stats[0][i]]);
d5.push([date, stats[0][i]]);
if (i < aYear.length) {
d6.push([date, aYear[i]]);
if (Date.UTC(1970, 0, dayOfYear -1) == date && dataset == 0 && TpOutput == 0){
$('#currentTP').append($('<td> '+aYear[i].toFixed(1)+' metric tons</td>'));
$('#averageTP').append($('<td> ('+((aYear[i]/stats[2][i])*100).toFixed(1)+'% of the 2000-'+(currentYear-1)+' average)</td>'))
TpOutput += 1;
}
if (Date.UTC(1970, 0, dayOfYear -1) == date && dataset == 1 && DrpOutput == 0){
$('#currentDRP').append($('<td> '+aYear[i].toFixed(1)+' metric tons</td>'));
$('#averageDRP').append($('<td> ('+((aYear[i]/stats[2][i])*100).toFixed(1)+'% of the 2000-'+(currentYear-1)+' average)</td>'))
DrpOutput += 1;
}
if (i == aYear.length - 1) {
f1.push([date,aYear[i]]);
f2.push([date,aYear[i]]);
f3.push([date,aYear[i]]);
f4.push([date,aYear[i]]);
f5.push([date,aYear[i]]);
}
}
else {
f1.push([date,f1[f1.length-1][1]+stats2[4][i]]);
f2.push([date,f2[f2.length-1][1]+stats2[3][i]]);
f3.push([date,f3[f3.length-1][1]+stats2[2][i]]);
f4.push([date,f4[f4.length-1][1]+stats2[1][i]]);
f5.push([date,f5[f5.length-1][1]+stats2[0][i]]);
}
d7.push([date, 860.0]);
for (y = 2000; y < currentYear; y++) {
dMany[y - 2000].push([date, years[y - 2000][i]]);
}
}
var result = [];
result.push({type: "area", name: "max", data: d1, linecolor: "#808080", color: '#F0F0F0'});
result.push({type: "area", name: "75%ile", data: d2, color: '#D0D0D0'});
result.push({type: "area", name: "mean", data: d3, color: '#D0D0D0', lineColor: '#808080'});
result.push({type: "area", name: "25%ile", data: d4, color: '#F0F0F0'});
result.push({type: "area", name: "min", data: d5, color: '#FFFFFF'});
result.push({type: "line", name: currentYear, data: d6, color: '#004400', lineWidth: 3});
result.push({
type: "line", name: "July 31 target", data: d7,
lineWidth: "1", visible: false, showInLegend: false, color: "#FF0000", dashStyle: "longdash"
});
for (y = 2000; y < currentYear-1; y++) {
result.push({
type: "line",
name: y,
data: dMany[y - 2000],
color: '#444444',
lineWidth: 1,
visible: false,
showInLegend: false
});
}
result.push({
type: "line",
name: "Min Forecast",
visible: false,
showInLegend: false,
data: f1,
color: '#888888',
lineWidth: 1,
dashStyle: "LongDash"
});
result.push({
type: "line",
name: "Forecast",
visible: false,
showInLegend: false,
data: f3,
color: '#444400',
lineWidth: 3,
dashStyle: "ShortDot"
});
result.push({
type: "line",
name: "Max Forecast",
visible: false,
showInLegend: false,
data: f5,
color: '#888888',
lineWidth: 1,
dashStyle: "LongDash"
});
return result;
}
var chart = null;
var lastYear = "none";
var lastParameter = "Total Phosphorus";
var offsetForTarget = 0;
var offsetForForecast = 0;
var months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
var rawData;
var startDay = 60;
var startMonth = 2;
$(function () {
rawData = loadData();
var lastI = rawData[0][1].length - 1;
var lastDate = rawData[0][1][lastI][0];
var nextDate = new Date();
var nextUpdate = new Date();
nextUpdate.setTime(lastDate.getTime() + 7 * 86400000);
var niceDate = $.datepicker.formatDate("MM d", lastDate);
var niceDate2 = $.datepicker.formatDate("MM d", nextDate);
//Append years to yearly dropdown box
var currentYear = lastDate.getFullYear();
for (i = 2000; i <= currentYear-1; i++) {
$('#year').append($('<option>').text(i));
}
//Write out planned next update (in a week) and the range of cumulative loads
$('#nextUpdate').append('<i> Data last updated '+$.datepicker.formatDate("MM dd", lastDate)+'; '+'next update planned for '+$.datepicker.formatDate("MM dd.", nextUpdate))+'</i>';
var plotData = loadPlotData(rawData, 0, startDay,lastDate); //"0" represents TP and "1" is DRP
$('#currentYearRange').append($.datepicker.formatDate("MM dd yy", lastDate));
//Calculate Day of Year of most recent date
var timestmp = new Date().setFullYear(currentYear, 0, 1);
var yearFirstDay = Math.floor(timestmp / 86400000);
var today = Math.ceil((lastDate.getTime()) / 86400000);
var dayOfYear = today - yearFirstDay;
var monthTickPositions = [];
for (i = 0; i < 6; i++) {
monthTickPositions.push(Date.UTC(1970, startMonth + i, 1))
}
chart = new Highcharts.Chart(
{
chart: {
type: 'area',
renderTo: 'container'
},
credits: {
enabled: false
},
subtitle: {
text: 'Cumulative Load from Maumee River to Western Lake Erie Basin'
},
title: {
text: ''
},
// subtitle: {
// text: '(March 1 to April 27, 2015)'
// },
xAxis: {
min: Date.UTC(1970, startMonth, 1),
max: Date.UTC(1970, startMonth + 5, 1),
tickPositions: monthTickPositions,
gridLineWidth: 1,
labels: {
formatter: function () {
if (this.isFirst) return null;
var date = new Date(this.value);
return date.toLocaleString("en-us", {month: "short"})
},
x: -80
}
},
yAxis: {
title: {
text: 'Total Phosphorus (metric tons)'
},
labels: {
formatter: function () {
return this.value;
}
}
},
tooltip: {
useHTML: true,
formatter: function () {
var date = new Date(this.x);
var s = '<b>' + months[date.getMonth()] + ' ' + date.getDate() + '</b>';
s = s + "<br><br><table>";
var y = this.points[4].y;
s = s + "<tr><td>Minimum: <td style='text-align:right'>" + y.toFixed(3) + " mt<br>";
y += this.points[3].y;
s = s + "<tr><td>25th percentile: <td style='text-align:right'>" + y.toFixed(3) + " mt<br>";
y += this.points[2].y;
s = s + "<tr><td>Average: <td style='text-align:right'>" + y.toFixed(3) + " mt<br>";
y += this.points[1].y;
s = s + "<tr><td>75th percentile: <td style='text-align:right'>" + y.toFixed(3) + " mt<br>";
y += this.points[0].y;
s = s + "<tr><td>Maximum: <td style='text-align:right'>" + y.toFixed(3) + " mt<br>";
if (lastYear == "none") {
if (this.points.length >5 + offsetForTarget && Date.UTC(1970, 0, dayOfYear -1) >= date) {
s = s + "<tr><td><b>"+currentYear+": <td style='text-align:right'>" + this.points[5].y.toFixed(3) + " mt</b><br>";
} else if(this.points.length >5 + offsetForTarget && Date.UTC(1970, 0, dayOfYear -1) < date && offsetForForecast > 0 && offsetForTarget == 0){
s = s + "<tr><td><b>" + this.points[6].series.name + ": <td style='text-align:right'>" + this.points[6 + offsetForTarget].y.toFixed(3) + " mt</b><br>";
}
} else {
if (this.points.length > 6 + offsetForTarget && offsetForTarget == 0 && offsetForForecast == 0 && Date.UTC(1970, 0, dayOfYear -1) >= date) {
s = s + "<tr><td><b>"+currentYear+": <td style='text-align:right'>" + this.points[5 + offsetForTarget].y.toFixed(3) + " mt</b><br>";
s = s + "<tr><td><b>" + this.points[6].series.name + ": <td style='text-align:right'>" + this.points[6 + offsetForTarget].y.toFixed(3) + " mt</b><br>";
}
else if (offsetForTarget == 0 && offsetForForecast == 0){
s = s + "<tr><td><b>" + this.points[5].series.name + ": <td style='text-align:right'>" + this.points[5 + offsetForTarget].y.toFixed(3) + " mt</b><br>";
}
if (this.points.length > 6 + offsetForTarget && offsetForTarget == 0 && offsetForForecast == 1 && Date.UTC(1970, 0, dayOfYear -1) >= date) {
s = s + "<tr><td><b>"+currentYear+": <td style='text-align:right'>" + this.points[5 + offsetForTarget].y.toFixed(3) + " mt</b><br>";
s = s + "<tr><td><b>" + this.points[6].series.name + ": <td style='text-align:right'>" + this.points[6 + offsetForTarget].y.toFixed(3) + " mt</b><br>";
}else if (offsetForTarget == 0 && offsetForForecast == 1 && Date.UTC(1970, 0, dayOfYear -1) < date) {
s = s + "<tr><td><b>"+ this.points[7].series.name +": <td style='text-align:right'>" + this.points[7 + offsetForTarget].y.toFixed(3) + " mt</b><br>";
s = s + "<tr><td><b>" + this.points[5].series.name + ": <td style='text-align:right'>" + this.points[5 + offsetForTarget].y.toFixed(3) + " mt</b><br>";
}
if (offsetForTarget > 0 && offsetForForecast == 1 && Date.UTC(1970, 0, dayOfYear -1) >= date) {
s = s + "<tr><td><b>" + this.points[5].series.name + ": <td style='text-align:right'>" + this.points[4 + offsetForTarget].y.toFixed(3) + " mt</b><br>";
s = s + "<tr><td><b>" + this.points[6 + offsetForTarget].series.name + ": <td style='text-align:right'>" + this.points[6 + offsetForTarget].y.toFixed(3) + " mt</b><br>";
s = s + "<tr><td>Suggested target: <td style='text-align:right'>" + this.points[5 + offsetForTarget].y.toFixed(3) + " mt<br>";
}
else if (offsetForTarget > 0 && offsetForForecast == 1 && Date.UTC(1970, 0, dayOfYear -1) < date) {
s = s + "<tr><td><b>" + this.points[8].series.name + ": <td style='text-align:right'>" + this.points[7 + offsetForTarget].y.toFixed(3) + " mt</b><br>";
s = s + "<tr><td><b>" + this.points[6].series.name + ": <td style='text-align:right'>" + this.points[5 + offsetForTarget].y.toFixed(3) + " mt</b><br>";
s = s + "<tr><td>Suggested target: <td style='text-align:right'>" + this.points[4 + offsetForTarget].y.toFixed(3) + " mt<br>";
}
if (offsetForTarget > 0 && offsetForForecast == 0 && Date.UTC(1970, 0, dayOfYear -1) >= date) {
s = s + "<tr><td><b>" + this.points[5].series.name + ": <td style='text-align:right'>" + this.points[4 + offsetForTarget].y.toFixed(3) + " mt</b><br>";
s = s + "<tr><td><b>" + this.points[6 + offsetForTarget].series.name + ": <td style='text-align:right'>" + this.points[6 + offsetForTarget].y.toFixed(3) + " mt</b><br>";
s = s + "<tr><td>Suggested target: <td style='text-align:right'>" + this.points[5 + offsetForTarget].y.toFixed(3) + " mt<br>";
}
else if (offsetForTarget > 0 && offsetForForecast == 0 && Date.UTC(1970, 0, dayOfYear -1) < date) {
s = s + "<tr><td><b>" + this.points[6].series.name + ": <td style='text-align:right'>" + this.points[5 + offsetForTarget].y.toFixed(3) + " mt</b><br>";
s = s + "<tr><td>Suggested target: <td style='text-align:right'>" + this.points[4 + offsetForTarget].y.toFixed(3) + " mt<br>";
}
}
if (lastYear == "none" && offsetForTarget > 0 && offsetForForecast == 0 && Date.UTC(1970, 0, dayOfYear -1) >= date) {
s = s + "<tr><td>Suggested target: <td style='text-align:right'>" + this.points[6].y.toFixed(3) + " mt<br>";
}else if (lastYear == "none" && offsetForTarget > 0 && offsetForForecast == 0 && Date.UTC(1970, 0, dayOfYear -1) < date) {
s = s + "<tr><td>Suggested target: <td style='text-align:right'>" + this.points[5].y.toFixed(3) + " mt<br>";
}
if (lastYear == "none" && offsetForTarget > 0 && offsetForForecast > 0 && Date.UTC(1970, 0, dayOfYear -1) >= date) {
s = s + "<tr><td>Suggested target: <td style='text-align:right'>" + this.points[6].y.toFixed(3) + " mt<br>";
}else if (lastYear == "none" && offsetForTarget > 0 && offsetForForecast > 0 && Date.UTC(1970, 0, dayOfYear -1) < date) {
s = s + "<tr><td><b>" + this.points[6 + offsetForTarget].series.name + ": <td style='text-align:right'>" + this.points[6 + offsetForTarget].y.toFixed(3) + " mt</b><br>";
s = s + "<tr><td>Suggested target: <td style='text-align:right'>" + this.points[5].y.toFixed(3) + " mt<br>";
}
s = s + "</table>";
return s;
},
shared: true
},
plotOptions: {
area: {
stacking: 'normal',
lineWidth: 1,
marker: {
lineWidth: 1
}
}
},
series: plotData
}
);
loadPlotData(rawData, 1, startDay,lastDate); //Call to produce the current Dissolved Reactive Phosphorus tons
//var chart2 = new Highcharts.Chart(Highcharts.merge(chart.options, {
// chart: {
// series: plotData,
// visible: false
// }
//}));
// Handle toggle of target
$('#target').change(function () {
if (this.checked) {
chart.series[6].show();
offsetForTarget = 1;
}
else {
chart.series[6].hide();
offsetForTarget = 0;
}
})
// Handle toggle of forecast
$('#forecast').change(function () {
if (this.checked) {
chart.series[23].show();
chart.series[24].show();
chart.series[22].show();
offsetForForecast = 1;
}
else {
chart.series[23].hide();
chart.series[24].hide();
chart.series[22].hide();
offsetForForecast = 0;
}
})
// Handle switch between parameters
$('#display').selectmenu({
change: function (event, data) {
if (data.item.value == 'Dissolved Reactive Phosphorus') {
plotData = loadPlotData(rawData, 1, startDay, lastDate);
chart = new Highcharts.Chart({
chart: {
type: 'area',
renderTo: 'container'
},
credits: {
enabled: false
},
subtitle: {
text: 'Cumulative Load from Maumee River to Western Lake Erie Basin'
},
title: {
text: ''
},
// subtitle: {
// text: '(March 1 to April 27, 2015)'
// },
xAxis: {
min: Date.UTC(1970, startMonth, 1),
max: Date.UTC(1970, startMonth + 5, 1),
tickPositions: monthTickPositions,
gridLineWidth: 1,
labels: {
formatter: function () {
if (this.isFirst) return null;
var date = new Date(this.value);
return date.toLocaleString("en-us", {month: "short"})
},
x: -80
}
},
yAxis: {
title: {
text: 'Dissolved Reactive Phosphorus (metric tons)'
},
labels: {
formatter: function () {
return this.value;
}
}
},
tooltip: {
useHTML: true,
formatter: function () {
var date = new Date(this.x);
var s = '<b>' + months[date.getMonth()] + ' ' + date.getDate() + '</b>';
s = s + "<br><br><table>";
var y = this.points[4].y;
s = s + "<tr><td>Minimum: <td style='text-align:right'>" + y.toFixed(3) + " mt<br>";
y += this.points[3].y;
s = s + "<tr><td>25th percentile: <td style='text-align:right'>" + y.toFixed(3) + " mt<br>";
y += this.points[2].y;
s = s + "<tr><td>Average: <td style='text-align:right'>" + y.toFixed(3) + " mt<br>";
y += this.points[1].y;
s = s + "<tr><td>75th percentile: <td style='text-align:right'>" + y.toFixed(3) + " mt<br>";
y += this.points[0].y;
s = s + "<tr><td>Maximum: <td style='text-align:right'>" + y.toFixed(3) + " mt<br>";
if (lastYear == "none") {
if (this.points.length >5 + offsetForTarget && Date.UTC(1970, 0, dayOfYear -1) >= date) {
s = s + "<tr><td><b>"+currentYear+": <td style='text-align:right'>" + this.points[5].y.toFixed(3) + " mt</b><br>";
} else if(this.points.length >5 + offsetForTarget && Date.UTC(1970, 0, dayOfYear -1) < date && offsetForForecast > 0 && offsetForTarget == 0){
s = s + "<tr><td><b>" + this.points[6].series.name + ": <td style='text-align:right'>" + this.points[6 + offsetForTarget].y.toFixed(3) + " mt</b><br>";
}
} else {
if (this.points.length > 6 + offsetForTarget && offsetForTarget == 0 && offsetForForecast == 0 && Date.UTC(1970, 0, dayOfYear -1) >= date) {
s = s + "<tr><td><b>"+currentYear+": <td style='text-align:right'>" + this.points[5 + offsetForTarget].y.toFixed(3) + " mt</b><br>";
s = s + "<tr><td><b>" + this.points[6].series.name + ": <td style='text-align:right'>" + this.points[6 + offsetForTarget].y.toFixed(3) + " mt</b><br>";
}
else if (offsetForTarget == 0 && offsetForForecast == 0){
s = s + "<tr><td><b>" + this.points[5].series.name + ": <td style='text-align:right'>" + this.points[5 + offsetForTarget].y.toFixed(3) + " mt</b><br>";
}
if (this.points.length > 6 + offsetForTarget && offsetForTarget == 0 && offsetForForecast == 1 && Date.UTC(1970, 0, dayOfYear -1) >= date) {
s = s + "<tr><td><b>"+currentYear+": <td style='text-align:right'>" + this.points[5 + offsetForTarget].y.toFixed(3) + " mt</b><br>";
s = s + "<tr><td><b>" + this.points[6].series.name + ": <td style='text-align:right'>" + this.points[6 + offsetForTarget].y.toFixed(3) + " mt</b><br>";
}else if (offsetForTarget == 0 && offsetForForecast == 1 && Date.UTC(1970, 0, dayOfYear -1) < date) {
s = s + "<tr><td><b>"+ this.points[7].series.name +": <td style='text-align:right'>" + this.points[7 + offsetForTarget].y.toFixed(3) + " mt</b><br>";
s = s + "<tr><td><b>" + this.points[5].series.name + ": <td style='text-align:right'>" + this.points[5 + offsetForTarget].y.toFixed(3) + " mt</b><br>";
}
if (offsetForTarget > 0 && offsetForForecast == 1 && Date.UTC(1970, 0, dayOfYear -1) >= date) {
s = s + "<tr><td><b>" + this.points[5].series.name + ": <td style='text-align:right'>" + this.points[4 + offsetForTarget].y.toFixed(3) + " mt</b><br>";
s = s + "<tr><td><b>" + this.points[6 + offsetForTarget].series.name + ": <td style='text-align:right'>" + this.points[6 + offsetForTarget].y.toFixed(3) + " mt</b><br>";
s = s + "<tr><td>Suggested target: <td style='text-align:right'>" + this.points[5 + offsetForTarget].y.toFixed(3) + " mt<br>";
}
else if (offsetForTarget > 0 && offsetForForecast == 1 && Date.UTC(1970, 0, dayOfYear -1) < date) {
s = s + "<tr><td><b>" + this.points[8].series.name + ": <td style='text-align:right'>" + this.points[7 + offsetForTarget].y.toFixed(3) + " mt</b><br>";
s = s + "<tr><td><b>" + this.points[6].series.name + ": <td style='text-align:right'>" + this.points[5 + offsetForTarget].y.toFixed(3) + " mt</b><br>";
s = s + "<tr><td>Suggested target: <td style='text-align:right'>" + this.points[4 + offsetForTarget].y.toFixed(3) + " mt<br>";
}
if (offsetForTarget > 0 && offsetForForecast == 0 && Date.UTC(1970, 0, dayOfYear -1) >= date) {
s = s + "<tr><td><b>" + this.points[5].series.name + ": <td style='text-align:right'>" + this.points[4 + offsetForTarget].y.toFixed(3) + " mt</b><br>";
s = s + "<tr><td><b>" + this.points[6 + offsetForTarget].series.name + ": <td style='text-align:right'>" + this.points[6 + offsetForTarget].y.toFixed(3) + " mt</b><br>";
s = s + "<tr><td>Suggested target: <td style='text-align:right'>" + this.points[5 + offsetForTarget].y.toFixed(3) + " mt<br>";
}
else if (offsetForTarget > 0 && offsetForForecast == 0 && Date.UTC(1970, 0, dayOfYear -1) < date) {
s = s + "<tr><td><b>" + this.points[6].series.name + ": <td style='text-align:right'>" + this.points[5 + offsetForTarget].y.toFixed(3) + " mt</b><br>";
s = s + "<tr><td>Suggested target: <td style='text-align:right'>" + this.points[4 + offsetForTarget].y.toFixed(3) + " mt<br>";
}
}
if (lastYear == "none" && offsetForTarget > 0 && offsetForForecast == 0 && Date.UTC(1970, 0, dayOfYear -1) >= date) {
s = s + "<tr><td>Suggested target: <td style='text-align:right'>" + this.points[6].y.toFixed(3) + " mt<br>";
}else if (lastYear == "none" && offsetForTarget > 0 && offsetForForecast == 0 && Date.UTC(1970, 0, dayOfYear -1) < date) {
s = s + "<tr><td>Suggested target: <td style='text-align:right'>" + this.points[5].y.toFixed(3) + " mt<br>";
}
if (lastYear == "none" && offsetForTarget > 0 && offsetForForecast > 0 && Date.UTC(1970, 0, dayOfYear -1) >= date) {
s = s + "<tr><td>Suggested target: <td style='text-align:right'>" + this.points[6].y.toFixed(3) + " mt<br>";
}else if (lastYear == "none" && offsetForTarget > 0 && offsetForForecast > 0 && Date.UTC(1970, 0, dayOfYear -1) < date) {
s = s + "<tr><td><b>" + this.points[6 + offsetForTarget].series.name + ": <td style='text-align:right'>" + this.points[6 + offsetForTarget].y.toFixed(3) + " mt</b><br>";
s = s + "<tr><td>Suggested target: <td style='text-align:right'>" + this.points[5].y.toFixed(3) + " mt<br>";
}
s = s + "</table>";
return s;
},
shared: true
},
plotOptions: {
area: {
stacking: 'normal',
lineWidth: 1,
marker: {
lineWidth: 1
}
}
},
series: plotData
});
//Check if the show target or show forecast has been previously checked.
if ($('#forecast').is(':checked')) {
chart.series[23].show();
chart.series[24].show();
chart.series[22].show();
offsetForForecast = 1;
console.log('true');
}
else {
chart.series[23].hide();
chart.series[24].hide();
chart.series[22].hide();
offsetForForecast = 0;
}
if ($('#target').is(':checked')) {
chart.series[6].show();
offsetForTarget = 1;
}
else {
chart.series[6].hide();
offsetForTarget = 0;
}
} else if(data.item.value == 'Total Phosphorus') {
chart.destroy();
plotData = loadPlotData(rawData, 0, startDay, lastDate);
chart = new Highcharts.Chart({
chart: {
type: 'area',
renderTo: 'container'
},
credits: {
enabled: false
},
subtitle: {
text: 'Cumulative Load from Maumee River to Western Lake Erie Basin'
},
title: {
text: ''
},
// subtitle: {
// text: '(March 1 to April 27, 2015)'
// },
xAxis: {
min: Date.UTC(1970, startMonth, 1),
max: Date.UTC(1970, startMonth + 5, 1),
tickPositions: monthTickPositions,
gridLineWidth: 1,
labels: {
formatter: function () {
if (this.isFirst) return null;
var date = new Date(this.value);
return date.toLocaleString("en-us", {month: "short"})
},
x: -80
}
},
yAxis: {
title: {
text: 'Total Phosphorus (metric tons)'
},
labels: {
formatter: function () {
return this.value;
}
}
},
tooltip: {
useHTML: true,
formatter: function () {
var date = new Date(this.x);
var s = '<b>' + months[date.getMonth()] + ' ' + date.getDate() + '</b>';
s = s + "<br><br><table>";
var y = this.points[4].y;
s = s + "<tr><td>Minimum: <td style='text-align:right'>" + y.toFixed(3) + " mt<br>";
y += this.points[3].y;
s = s + "<tr><td>25th percentile: <td style='text-align:right'>" + y.toFixed(3) + " mt<br>";
y += this.points[2].y;
s = s + "<tr><td>Average: <td style='text-align:right'>" + y.toFixed(3) + " mt<br>";
y += this.points[1].y;
s = s + "<tr><td>75th percentile: <td style='text-align:right'>" + y.toFixed(3) + " mt<br>";
y += this.points[0].y;
s = s + "<tr><td>Maximum: <td style='text-align:right'>" + y.toFixed(3) + " mt<br>";
if (lastYear == "none") {
if (this.points.length >5 + offsetForTarget && Date.UTC(1970, 0, dayOfYear -1) >= date) {
s = s + "<tr><td><b>"+currentYear+": <td style='text-align:right'>" + this.points[5].y.toFixed(3) + " mt</b><br>";
} else if(this.points.length >5 + offsetForTarget && Date.UTC(1970, 0, dayOfYear -1) < date && offsetForForecast > 0 && offsetForTarget == 0){
s = s + "<tr><td><b>" + this.points[6].series.name + ": <td style='text-align:right'>" + this.points[6 + offsetForTarget].y.toFixed(3) + " mt</b><br>";
}
} else {
if (this.points.length > 6 + offsetForTarget && offsetForTarget == 0 && offsetForForecast == 0 && Date.UTC(1970, 0, dayOfYear -1) >= date) {
s = s + "<tr><td><b>"+currentYear+": <td style='text-align:right'>" + this.points[5 + offsetForTarget].y.toFixed(3) + " mt</b><br>";
s = s + "<tr><td><b>" + this.points[6].series.name + ": <td style='text-align:right'>" + this.points[6 + offsetForTarget].y.toFixed(3) + " mt</b><br>";
}
else if (offsetForTarget == 0 && offsetForForecast == 0){
s = s + "<tr><td><b>" + this.points[5].series.name + ": <td style='text-align:right'>" + this.points[5 + offsetForTarget].y.toFixed(3) + " mt</b><br>";
}
if (this.points.length > 6 + offsetForTarget && offsetForTarget == 0 && offsetForForecast == 1 && Date.UTC(1970, 0, dayOfYear -1) >= date) {
s = s + "<tr><td><b>"+currentYear+": <td style='text-align:right'>" + this.points[5 + offsetForTarget].y.toFixed(3) + " mt</b><br>";
s = s + "<tr><td><b>" + this.points[6].series.name + ": <td style='text-align:right'>" + this.points[6 + offsetForTarget].y.toFixed(3) + " mt</b><br>";
}else if (offsetForTarget == 0 && offsetForForecast == 1 && Date.UTC(1970, 0, dayOfYear -1) < date) {
s = s + "<tr><td><b>"+ this.points[7].series.name +": <td style='text-align:right'>" + this.points[7 + offsetForTarget].y.toFixed(3) + " mt</b><br>";
s = s + "<tr><td><b>" + this.points[5].series.name + ": <td style='text-align:right'>" + this.points[5 + offsetForTarget].y.toFixed(3) + " mt</b><br>";
}
if (offsetForTarget > 0 && offsetForForecast == 1 && Date.UTC(1970, 0, dayOfYear -1) >= date) {
s = s + "<tr><td><b>" + this.points[5].series.name + ": <td style='text-align:right'>" + this.points[4 + offsetForTarget].y.toFixed(3) + " mt</b><br>";
s = s + "<tr><td><b>" + this.points[6 + offsetForTarget].series.name + ": <td style='text-align:right'>" + this.points[6 + offsetForTarget].y.toFixed(3) + " mt</b><br>";
s = s + "<tr><td>Suggested target: <td style='text-align:right'>" + this.points[5 + offsetForTarget].y.toFixed(3) + " mt<br>";
}
else if (offsetForTarget > 0 && offsetForForecast == 1 && Date.UTC(1970, 0, dayOfYear -1) < date) {
s = s + "<tr><td><b>" + this.points[8].series.name + ": <td style='text-align:right'>" + this.points[7 + offsetForTarget].y.toFixed(3) + " mt</b><br>";
s = s + "<tr><td><b>" + this.points[6].series.name + ": <td style='text-align:right'>" + this.points[5 + offsetForTarget].y.toFixed(3) + " mt</b><br>";
s = s + "<tr><td>Suggested target: <td style='text-align:right'>" + this.points[4 + offsetForTarget].y.toFixed(3) + " mt<br>";
}
if (offsetForTarget > 0 && offsetForForecast == 0 && Date.UTC(1970, 0, dayOfYear -1) >= date) {
s = s + "<tr><td><b>" + this.points[5].series.name + ": <td style='text-align:right'>" + this.points[4 + offsetForTarget].y.toFixed(3) + " mt</b><br>";
s = s + "<tr><td><b>" + this.points[6 + offsetForTarget].series.name + ": <td style='text-align:right'>" + this.points[6 + offsetForTarget].y.toFixed(3) + " mt</b><br>";
s = s + "<tr><td>Suggested target: <td style='text-align:right'>" + this.points[5 + offsetForTarget].y.toFixed(3) + " mt<br>";
}
else if (offsetForTarget > 0 && offsetForForecast == 0 && Date.UTC(1970, 0, dayOfYear -1) < date) {
s = s + "<tr><td><b>" + this.points[6].series.name + ": <td style='text-align:right'>" + this.points[5 + offsetForTarget].y.toFixed(3) + " mt</b><br>";
s = s + "<tr><td>Suggested target: <td style='text-align:right'>" + this.points[4 + offsetForTarget].y.toFixed(3) + " mt<br>";
}
}
if (lastYear == "none" && offsetForTarget > 0 && offsetForForecast == 0 && Date.UTC(1970, 0, dayOfYear -1) >= date) {
s = s + "<tr><td>Suggested target: <td style='text-align:right'>" + this.points[6].y.toFixed(3) + " mt<br>";
}else if (lastYear == "none" && offsetForTarget > 0 && offsetForForecast == 0 && Date.UTC(1970, 0, dayOfYear -1) < date) {
s = s + "<tr><td>Suggested target: <td style='text-align:right'>" + this.points[5].y.toFixed(3) + " mt<br>";
}
if (lastYear == "none" && offsetForTarget > 0 && offsetForForecast > 0 && Date.UTC(1970, 0, dayOfYear -1) >= date) {
s = s + "<tr><td>Suggested target: <td style='text-align:right'>" + this.points[6].y.toFixed(3) + " mt<br>";
}else if (lastYear == "none" && offsetForTarget > 0 && offsetForForecast > 0 && Date.UTC(1970, 0, dayOfYear -1) < date) {
s = s + "<tr><td><b>" + this.points[6 + offsetForTarget].series.name + ": <td style='text-align:right'>" + this.points[6 + offsetForTarget].y.toFixed(3) + " mt</b><br>";
s = s + "<tr><td>Suggested target: <td style='text-align:right'>" + this.points[5].y.toFixed(3) + " mt<br>";
}
s = s + "</table>";
return s;
},
shared: true
},
plotOptions: {
area: {
stacking: 'normal',
lineWidth: 1,
marker: {
lineWidth: 1
}
}
},
series: plotData
});
}
}
});
// Handle switch of single year being displayed
$('#year').selectmenu({
change: function (event, data) {
if (lastYear != "none") {
chart.series[lastYear - 1993].hide();
chart.series[lastYear - 1993].showInLegend = false;
}
lastYear = data.item.value;
if (lastYear != "none") {
chart.series[lastYear - 1993].lineColor = '#802020';
chart.series[lastYear - 1993].showInLegend = true;
chart.series[lastYear - 1993].show();
}
chart.isDirtyBox = true;
chart.redraw();
}
}
);
}
)
</script>
<style>
fieldset {
border: 0;
margin-left: 50px;
}
.ui-widget {
font-size: 75% !important;
}
select {
width: 200px;
}
body, td, th {
font-family: Candara, Calibri, Segoe UI;
}
</style>
<link href="tribtool.css" rel="stylesheet" type="text/css">
</head>
<body id="pid-home"
class="front not-logged-in page-node node-type-page no-sidebars full-node layout-main sidebars-split font-size-12 grid-type-960 grid-width-16">
<div id="page" class="page">
<div id="page-inner" class="page-inner">
<!-- header-top row: width = grid_width -->
<div id="header-top-wrapper" class="header-top-wrapper full-width">
<div id="header-top" class="header-top row grid16-16">
<div id="header-top-inner" class="header-top-inner inner clearfix">
<div class="inner clearfix">
<div class="content clearfix">
</div>
</div>
<!-- /block-inner -->
</div>
<!-- /block -->
<div id="logo"> <a href="http://www.glos.us/" title="Home"><img src="/images/glos_logo_maumee_60.png" alt="Home" hspace="3"/></a>
<!-- Draft (3/29/2017) -->
<!-- /site-name-wrapper -->
</div>
<!-- /header-site-info-inner -->
</div>
<!-- /header-site-info -->
</br></br></br>
<div id="page-content" class="page-content">
<p><br><br>
<table width="900">
<tr>
<td width="600">
<p id="currentYearRange"><b>Cumulative Loads</b> March 1 to </p>
<table>
<tr>
<td> Total Phosphorus:
<td id="currentTP"></td>
<td id="averageTP"></td> <br>
<tr>
<td> Dissolved Reactive Phosphorus:
<td id="currentDRP"></td>
<td id="averageDRP"></td> <br>
</table>
<br>
<p id="nextUpdate"></p>
</p>
</td>
<td>
<fieldset>
<input type="checkbox" id="target">Show</input>
<br>
<input type="checkbox" id="forecast">Show forecast</input>
<br>
<select id="display" name="display">
<option value="Total Phosphorus" selected="selected">Total Phosphorus</option>
<option value="Dissolved Reactive Phosphorus">Dissolved Reactive Phosphorus</option>
</select>
<br>
<select id="year" name="year">
<option selected="selected" value="none">none</option>
<!-- <option value="2000">2000</option>
<option value="2001">2001</option>
<option value="2002">2002</option>
<option value="2003">2003</option>
<option value="2004">2004</option>
<option value="2005">2005</option>
<option value="2006">2006</option>
<option>2007</option>
<option>2008</option>
<option>2009</option>
<option>2010</option>
<option>2011</option>
<option>2012</option>
<option>2013</option>
<option>2014</option>
<option>2015</option>
<option>2016</option>-->
</select>
</fieldset>
</td>
</tr>
<tr>
<td colspan="2">
<div id="container" style="display: block; width: 900px; height: 600px; margin: 0 auto"></div>
<div id="container2" style="display: none; width: 900px; height: 600px; margin: 0 auto"></div>
<p>The extent and severity of algal blooms in the Western Lake Erie Basin (WLEB) have been shown
to be
correlated with the amount of nutrients (nutrient load) entering the WLEB from the Maumee
River
Watershed through the Maumee River. Measurements of the concentration of nutrients in the
Maumee River
are collected by Heidelberg University and combined with USGS measurements of Maumee River
flow to
calculate daily nutrient loads. This web page’s tracking tool sums up nutrient loads
day-to-day to show
the current year’s total nutrient load entering the WLEB through the Maumee River, and
charts the
cumulative loads in the context of previous (2000-2014) years’ ranges.
</p>
<p>Heidelberg University retrieves water samples and performs laboratory analyses of the
samples’ water
chemistry on a regular schedule. During the critical spring and summer seasons of 2015,
Heidelberg plans
to publish analytical results and calculated daily loads on a weekly basis. The intensive
schedule,
along with development and implementation of this web page in partnership with the Great
Lakes Observing
System, is supported by the Great Lakes Restoration Initiative and the National Oceanic and
Atmospheric
Agency’s Great Lakes Environmental Research Laboratory.
<p>
Much more information is available from the following links:
</p>
</td>
</tr>
</table>
<p><a href="http://lakeerie.ohio.gov/Portals/0/Reports/Task_Force_Report_October_2013.pdf"
title="Click to access report recommending spring target of 800 metric tons TP and 150 metric tons DRP">suggested
target</a> </p>
<br>
</div>
<!-- footer row: width = grid_width -->
<div id="footer-wrapper" class="footer-wrapper full-width">
<div id="footer" class="footer row grid16-16">
<div id="footer-inner" class="footer-inner inner clearfix">
<div id="block-block-1" class="block block-block odd first grid16-9">
<div class="inner clearfix">
<div class="content clearfix">
<table>
<tr>
<td width="615" valign="top"><p><a href="http://www.glos.us/"><img src="images/glos_logo_60.png" width="228" height="60"></a></p>
<p>© 2017 Great Lakes Observing System<br>
4840 State Road, Ann Arbor, MI 48108</p>
<p><a href="http://www.glos.us/contact/">Contact Us</a></p> </td>
<td width="809"><p><span class="style2">Regional Coastal Observing Systems:</span><br>
<a href="http://www.aoos.org/" target="_blank">Alaska</a> • <a href="http://cara.uprm.edu/" target="_blank">Caribbean</a> • <a href="http://www.cencoos.org/" target="_blank">Central & Northern California</a><br />
<a href="http://glos.us" target="_blank">Great Lakes</a> • <a href="http://gcoos.org" target="_blank">Gulf of Mexico</a> • <a href="http://www.soest.hawaii.edu/pacioos/" target="_blank">Pacific Islands</a> • <a href="http://maracoos.org/" target="_blank">Mid-Atlantic</a> • <a href="http://www.neracoos.org/" target="_blank">Northeast-Atlantic</a><br />
<a href="http://www.nanoos.org/" target="_blank">Pacific Northwest</a> • <a href="http://www.sccoos.org/" target="_blank">Southern California</a> • <a href="http://secoora.org/" target="_blank">Southeast-Atlantic</a><br />
<a href="http://www.ioosassociation.org/">Integrated Ocean Observing System Association</a></p>
<p><span class="style2">National Observing System Partners: </span><br>
<a href="http://www.act-us.info/" target="_blank">Alliance for Coastal Technologies (ACT)</a> • <a href="http://www.sura.org/home/" target="_blank">Southeastern Universities Research Association (SURA)</a></p>
<p><a href="https://ioos.noaa.gov/"><img src="images/ioos_logo.png" width="160" height="70"></a><img src="images/RICE_logo.png" width="112" height="110" hspace="20"></p></td>
</tr>
</table>
</div>
</div>
<!-- /block-inner -->
</div>
<!-- /block -->
<div id="block-block-4" class="block block-block even grid16-4 fusion-right social">
<div class="inner clearfix">
<div class="content clearfix"> </div>
</div>
<!-- /block-inner -->
</div>
<!-- /block -->
</div>
</div>
</div>
</div>
</body>
</html>