-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSedimentDataExplorer.html
More file actions
1243 lines (1107 loc) · 52.9 KB
/
SedimentDataExplorer.html
File metadata and controls
1243 lines (1107 loc) · 52.9 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
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
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Sediment Data Explorer</title>
<!-- External Scripts and Styles (Unchanged) -->
<!-- <script src="https://cdn.jsdelivr.net/npm/chart.js"></script> -->
<!-- <script src="https://rawgit.com/kawanet/msgpack-lite/master/dist/msgpack.min.js"></script> -->
<script src="https://unpkg.com/flatted@3.2.9/min.js"></script>
<script src="https://unpkg.com/chroma-js/dist/chroma.min.cjs"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/4.4.1/chart.umd.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/chartjs-plugin-autocolors"></script>
<script src="https://cdn.jsdelivr.net/npm/chartjs-plugin-annotation"></script>
<script src="https://cdn.jsdelivr.net/npm/chartjs-plugin-zoom"></script>
<script src="https://cdn.jsdelivr.net/npm/chartjs-plugin-datalabels"></script>
<script src="chart-plugin-select-sample.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.13.4/xlsx.full.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjs/10.0.0/math.min.js"></script>
<link rel="stylesheet" href="https://unpkg.com/leaflet/dist/leaflet.css" />
<script src="https://unpkg.com/leaflet/dist/leaflet.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.7.5/proj4.js"></script>
<script src="https://harrywood.co.uk/maps/examples/leaflet/leaflet-plugins/layer/vector/KML.js"></script>
<script src="https://unpkg.com/leaflet.layergroup.collision@0.2.0/dist/leaflet.layergroup.collision-src.js"></script>
<script src="https://unpkg.com/leaflet.markercluster@1.4.1/dist/leaflet.markercluster.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet.draw/1.0.4/leaflet.draw.css"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet.draw/1.0.4/leaflet.draw.js"></script>
<script src="https://cdn.jsdelivr.net/npm/pca-js@1.0.0/pca.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/patternomaly@1.3.2/dist/patternomaly.min.js"></script>
<script src="https://www.patrick-wied.at/static/heatmapjs/assets/js/heatmap.min.js"></script>
<script src="https://www.patrick-wied.at/static/heatmapjs/assets/js/leaflet-heatmap.js"></script>
<link rel="stylesheet" href="https://unpkg.com/leaflet.markercluster@1.4.1/dist/MarkerCluster.css" />
<link rel="stylesheet" href="https://unpkg.com/leaflet.markercluster@1.4.1/dist/MarkerCluster.Default.css" />
<!-- UI Styles -->
<style>
:root {
--primary-color: #005A9C;
--secondary-color: #003366;
--background-color: #f4f7fa;
--surface-color: #ffffff;
--text-color: #333333;
--border-color: #dce1e6;
--hover-color: #e9eff5;
--shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
margin: 0;
background-color: var(--background-color);
color: var(--text-color);
display: flex;
flex-direction: column;
height: 100vh;
overflow: hidden; /* Prevent body scroll */
}
/* Main Layout */
.app-container {
display: flex;
flex-grow: 1;
overflow: hidden;
position: relative;
}
.controls-sidebar {
width: 380px;
flex-shrink: 0; /* Prevent sidebar from shrinking */
background-color: var(--surface-color);
border-right: 1px solid var(--border-color);
padding: 1rem;
overflow-y: auto;
transition: width 0.3s ease, padding 0.3s ease;
position: relative;
}
/*
.output-area {
flex-grow: 1;
padding: 1.5rem;
overflow-y: auto;
position: relative;
}
*/
/* Update the .output-area to be a flex container that is fixed in height */
.output-area {
flex-grow: 1;
padding: 1.5rem;
position: relative;
display: flex; /* Make it a flex container */
flex-direction: column; /* Stack children vertically */
overflow: hidden; /* Prevent the main output area from scrolling */
}
/* NEW: Add a fixed container for the map and tabs */
.fixed-header-container {
position: sticky; /* This is the key */
top: 0; /* Stick it to the top */
z-index: 10; /* Ensure it's above the charts */
background-color: var(--background-color);
padding-bottom: 1.5rem;
padding-top: 1.5rem;
box-shadow: 0 4px 6px -4px rgba(0, 0, 0, 0.1); /* Optional: Adds a subtle shadow on scroll */
}
/* NEW: Add a scrollable container for the charts */
.scrollable-content {
flex-grow: 1; /* This makes the container fill the remaining space */
overflow-y: auto; /* This adds the vertical scrollbar */
/* Add padding to account for the space taken by the fixed header, preventing overlap */
padding-top: 1rem;
}
/* Collapsible Sidebar Styles */
.controls-sidebar.collapsed {
width: 0;
padding: 1rem 0;
border-right: none;
overflow: hidden;
}
.controls-sidebar.collapsed > * {
display: none;
}
#sidebar-toggle {
position: fixed;
left: 10px;
top: 50%;
transform: translateY(-50%);
z-index: 100;
width: 32px;
height: 32px;
padding: 0;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 1px 3px rgba(0,0,0,0.2);
border: 1px solid var(--border-color);
transition: left 0.3s ease;
}
/* Header */
header {
background-color: var(--secondary-color);
color: white;
padding: 0.75rem 1.5rem;
display: flex;
justify-content: space-between;
align-items: center;
box-shadow: var(--shadow);
z-index: 10;
}
header h1 {
font-size: 1.4rem;
margin: 0;
}
/* General Controls Styling */
button {
background-color: var(--primary-color);
color: white;
border: none;
padding: 0.6rem 1rem;
border-radius: 5px;
cursor: pointer;
font-size: 0.9rem;
font-weight: 500;
transition: background-color 0.2s ease;
}
button:hover {
background-color: var(--secondary-color);
}
button.secondary {
background-color: #6c757d;
}
button.secondary:hover {
background-color: #5a6268;
}
input[type="text"],
input[type="number"],
input[type="file"],
input[type="date"],
select {
width: 100%;
padding: 0.5rem;
border: 1px solid var(--border-color);
border-radius: 4px;
box-sizing: border-box;
font-size: 0.9rem;
}
input[type="file"] {
padding: 0.25rem;
}
/* Fieldset for Grouping */
fieldset {
border: 1px solid var(--border-color);
border-radius: 6px;
padding: 1rem;
margin-bottom: 1.5rem;
display: flex;
flex-direction: column;
gap: 0.8rem;
}
legend {
font-weight: 600;
padding: 0 0.5rem;
color: var(--primary-color);
}
label {
font-size: 0.85rem;
font-weight: 500;
}
.checkbox-group label, .radio-group label {
display: flex;
align-items: center;
gap: 0.5rem;
font-weight: normal;
}
/* Modal Styles */
.modal {
display: none; /* Hidden by default */
position: fixed;
z-index: 1000;
left: 0;
top: 0;
width: 100%;
height: 100%;
overflow: auto;
background-color: rgba(0, 0, 0, 0.5);
}
.modal-content {
background-color: var(--surface-color);
margin: 10% auto;
padding: 2rem;
border: 1px solid var(--border-color);
border-radius: 8px;
width: 80%;
max-width: 700px;
box-shadow: 0 5px 15px rgba(0,0,0,0.3);
display: flex;
flex-direction: column;
gap: 1rem;
position: relative;
}
.modal-content h2 {
margin-top: 0;
color: var(--secondary-color);
}
.modal-footer {
display: flex;
justify-content: flex-end;
gap: 0.5rem;
margin-top: 1rem;
}
.close-button {
color: #aaa;
position: absolute;
top: 10px;
right: 20px;
font-size: 28px;
font-weight: bold;
line-height: 1;
}
.close-button:hover,
.close-button:focus {
color: #000;
text-decoration: none;
cursor: pointer;
}
/* Map and Chart Containers */
#map {
aspect-ratio: 2 / 1; /* Width:Height = 2:1 (height is 50% of width) */
width: 100%; /* Or any other width value */
border-radius: 6px;
border: 1px solid var(--border-color);
}
#chartContainer button {
font-size: 0.8rem;
padding: 0.3rem 0.6rem;
margin: 0 4px 8px 0;
}
/* Tab container styles */
.tab-buttons {
border-bottom: 2px solid var(--border-color);
margin-bottom: 1rem;
}
.tab-buttons button {
background-color: transparent;
border: none;
border-bottom: 3px solid transparent;
color: var(--text-color);
padding: 0.75rem 1.25rem;
cursor: pointer;
font-size: 0.9rem;
font-weight: 500;
transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
margin-bottom: -2px;
}
.tab-buttons button:hover {
color: var(--primary-color);
background-color: var(--hover-color);
}
.tab-buttons button.active {
color: var(--primary-color);
border-bottom-color: var(--primary-color);
background-color: var(--surface-color);
}
.tab-content {
display: none;
}
.tab-content.active {
display: block;
}
/* NEW: Map Legend Styles */
.map-legend-container {
position: absolute;
bottom: 80px; /* Position above map buttons */
right: 20px;
z-index: 1000; /* Ensure it's on top of the map */
background: rgba(255, 255, 255, 0.85);
padding: 10px;
border-radius: 5px;
border: 1px solid #ccc;
box-shadow: 0 1px 5px rgba(0,0,0,0.4);
max-height: 200px;
overflow-y: auto;
}
.map-legend-container h4 {
margin: 0 0 5px 0;
text-align: center;
}
.legend-item {
display: flex;
align-items: center;
margin-bottom: 5px;
}
.legend-item img {
width: 18px;
height: 18px;
margin-right: 8px;
}
.scatter-chart-wrapper {
position: relative;
width: 100%;
height: 400px; /* Set a fixed height or use min-height */
flex: 1; /* If using flexbox */
}
.scatter-chart-wrapper canvas {
width: 100% !important;
height: 100% !important;
}
.scatter-flex-container {
display: flex;
flex-wrap: wrap;
gap: 20px;
}
.scatter-flex-container {
display: flex;
flex-wrap: wrap;
/* gap: 1rem; /* Adds space between charts */
}
.scatter-chart-wrapper {
flex: 1 1 100%; /* Default to full width on small screens */
/*flex-grow: 0; This prevents items from growing to fill space */
/* flex-shrink: 0;*/
min-width: 140px; /* Prevents charts from becoming too small */
/* height: 300px; /* Crucial: Gives the container a height */
position: relative; /* Required for Chart.js responsiveness */
}
/* Media queries for responsive columns */
@media (min-width: 768px) {
.scatter-chart-wrapper {
flex-basis: 24%; /* 4 columns on medium screens */
/* flex-basis: 48%; /* 2 columns on medium screens */
}
}
@media (min-width: 1200px) {
.scatter-chart-wrapper {
flex-basis: 23%; /* 4 columns on large screens */
}
}
.info.legend {
padding: 6px 8px;
font: 14px/16px Arial, Helvetica, sans-serif;
background: white;
background: rgba(255,255,255,0.8);
box-shadow: 0 0 15px rgba(0,0,0,0.2);
border-radius: 5px;
}
.legend i {
width: 18px;
height: 18px;
float: left;
margin-right: 8px;
opacity: 0.7;
}
.legend.circle-legend-item {
display: flex;
align-items: center;
margin-bottom: 4px;
}
.output-area.fixed-map {
display: flex;
flex-direction: column;
height: 40%; /* Important: Ensure the container has a defined height */
overflow-y: hidden; /* Prevent the main area from scrolling */
}
.fixed-map-container {
position: sticky;
top: 0;
z-index: 5;
background-color: var(--background-color);
padding-bottom: 1.5rem;
}
.scrollable-charts-container {
flex-grow: 1; /* This makes the container fill the remaining space */
overflow-y: auto; /* This adds the scrollbar */
padding-top: 1.5rem;
}
/* Ensure map containers render properly
div[id$="-contaminant-map"], div[id^="smallmap-"] {
position: relative !important;
display: block !important;
overflow: hidden !important;
}*/
/* Force Leaflet containers to take full space */
.leaflet-container {
width: 100% !important;
min-height: 90% !important;
}
/* Force Leaflet normal map containers to take half height */
.map-container-original {
width: 100% !important;
min-height: 50% !important;
}
/* Ensure tiles render in correct position */
.leaflet-map-pane {
left: 0 !important;
top: 0 !important;
}
/*div[id$="contaminant-map"], div[id^="smallmap-"] {
position: relative;
}*/
/*
.leaflet-container {
position: relative;
outline: 0;
}*/
.small-map-wrapper {
min-height: 280px !important;
min-width: 250px !important;
display: block !important;
}
div[id^="smallmap-"] {
display: block !important;
width: 100% !important;
height: calc(100% - 50px) !important;
min-height: 200px !important;
}
div[id^="largemap-"] {
display: block !important;
width: 100% !important;
height: calc(100% - 50px) !important;
min-height: 700px !important;
}
#largeContaminantMapId {
height: 500px; /* Or whatever height you need */
width: 100%;
}
.collapsible-legend {
cursor: pointer;
}
.collapsible-content {
max-height: 0;
overflow: hidden;
transition: max-height 0.3s ease-out; /* Adjust the duration as needed */
}
.collapsible-content.show-content {
max-height: 750px; /* Use a value larger than your content will ever be */
}
/* Make the app container take up the full viewport height */
.app-container {
display: flex; /* Use flexbox to align children */
height: 100vh; /* Set height to 100% of the viewport height */
}
/* Make the main content area flexible */
.output-area {
flex-grow: 1; /* This will make the main content area take up the remaining space */
display: flex;
flex-direction: column;
}
/* Ensure the sidebar scrolls if its content overflows */
.controls-sidebar {
overflow-y: auto; /* Enable vertical scrolling */
/* Other sidebar styles (width, etc.) go here */
}
/* Add this new class for horizontal layouts */
.horizontal-group {
flex-direction: row;
display: flex;
flex-wrap: wrap;
gap: 15px; /* Adds space between items */
align-items: center; /* Vertically aligns elements */
}
.input-group {
display: flex;
flex-direction: row; /* Change to row to align items horizontally */
flex-wrap: wrap; /* Allows items to wrap onto a new line if the container is too narrow */
gap: 15px; /* Adds horizontal space between the elements */
align-items: center; /* Vertically aligns the labels and inputs */
margin-bottom: 15px; /* Adds space between lines */
}
.input-line {
/* Make this container a flexbox container */
display: flex;
/* This aligns the items horizontally */
flex-wrap: wrap;
/* This adds space between the items */
gap: 15px;
/* This vertically centers the labels and inputs */
align-items: center;
/* Adds vertical space between the lines of inputs */
margin-bottom: 15px;
}
.input-line label {
white-space: nowrap; /* Prevents the label text from wrapping */
}
</style>
</head>
<body>
<div id="everything" style="display: none;"></div>
<header>
<h1>Sediment Data Explorer <small style="font-weight: normal; opacity: 0.8;">v2.20260409</small></h1>
<div class="header-actions">
<button onclick="updateChart()">(Re)Plot Chart</button>
<button onclick="exportCharts()" class="secondary">Export Chart</button>
<button onclick="clearData()" class="secondary">Clear Data</button>
<button id="toggleMapBtn" onclick="toggleMap()">Hide Map</button>
</div>
</header>
<div class="app-container">
<aside id="controls-sidebar" class="controls-sidebar collapsed">
<fieldset>
<legend class="collapsible-legend">Data Sources</legend>
<div class="collapsible-content">
<div class="input-group">
<label for="fileInput">MMO Templates (Local Files)</label>
<input type="file" id="fileInput" multiple onchange="importData()">
</div>
<div class="input-group">
<label for="urlInput">MMO Templates (URLs)</label>
<input type="text" id="urlInput" placeholder="Enter comma-separated URLs" onchange="importData()">
</div>
<button onclick="importData()">Import MMO Data</button>
<hr>
<button onclick="openCEFASSelection()">Select CEFAS Data</button>
<button onclick="openAdditionalInfoModal()">Additional Information</button>
</div>
</fieldset>
<fieldset>
<legend class="collapsible-legend">Save / Load State</legend>
<div class="collapsible-content">
<div class="input-group">
<label for="fileSave">Save Snapshot</label>
<input type="text" id="fileSave" placeholder="Enter file name to save" onchange="saveSnapShot()">
</div>
<div class="input-group">
<label for="fileLoad">Load Snapshot from File</label>
<input type="file" id="fileLoad" onchange="loadSnapShotFile()">
</div>
<div class="input-group">
<label for="urlLoad">Load Snapshot from URL</label>
<input type="text" id="urlLoad" placeholder="Enter URL to load" onchange="loadSnapShotURL()">
</div>
</div>
</fieldset>
<fieldset>
<legend class="collapsible-legend">Selection Tools</legend>
<div class="collapsible-content">
<button onclick="openDatasetSelection(sampleMeasurements)">Select Datasets</button>
<button onclick="openSampleSelection(sampleMeasurements)">Select Samples</button>
<button onclick="openChemicalSelection()">Select Chemicals</button>
<button onclick="clearSelections()" class="secondary">Clear All Selections</button>
</div>
</fieldset>
<fieldset>
<legend class="collapsible-legend">Chart Configuration</legend>
<div class="collapsible-content">
<p><strong>Sheetnames to Include:</strong></p>
<div class="checkbox-group">
<label><input type="checkbox" id="physicaldata" checked> Physical data</label>
<label><input type="checkbox" id="tracemetaldata" checked> Trace metal data</label>
<label><input type="checkbox" id="pahdata" checked> PAH data</label>
<label><input type="checkbox" id="pcbdata" checked> PCB data</label>
<label><input type="checkbox" id="bdedata" checked> BDE data</label>
<label><input type="checkbox" id="organotinsdata" checked> Organotins data</label>
<label><input type="checkbox" id="organochlorinedata" checked> Organochlorine data</label>
</div>
<hr>
<p><strong>Physical Chart Types:</strong></p>
<div class="checkbox-group">
<label><input type="checkbox" id="splitbyweight" checked> Split by weight</label>
<label><input type="checkbox" id="splitbyarea" checked> Split by area</label>
<label><input type="checkbox" id="totalsolidsandtotalcarbon" checked> Total solids and total carbon</label>
<label><input type="checkbox" id="cumulative" checked> Cumulative</label>
</div>
<button onclick="openParticleSizeModal()">Small particle details</button>
<p><strong>Chemical Chart Types:</strong></p>
<div class="checkbox-group">
<label><input type="checkbox" id="samplegroup" checked> Group by sample</label>
<label><input type="checkbox" id="chemicalgroup" checked> Group by chemical</label>
<label><input type="checkbox" id="correlationplots"> Correlation plots</label>
<label><input type="checkbox" id="pcaanalysis"> PCA analysis</label>
<label><input type="checkbox" id="mapgrid"> Map grid</label>
<button onclick="openAdditionalChartsModal()">Additional Charts</button>
<button onclick="openPcaOptionsModal()">PCA Options</button>
<hr>
</div>
<p><strong>Relations:</strong></p>
<div class="checkbox-group">
<label><input type="checkbox" id="relationareadensity"> Area density</label>
<label><input type="checkbox" id="relationhc"> Total hydrocarbons</label>
<label><input type="checkbox" id="relationtotalsolids"> Total solids</label>
<label><input type="checkbox" id="relationorganiccarbon"> Organic Carbon</label>
</div>
</div>
</fieldset>
<fieldset>
<legend class="collapsible-legend">Chart Customisation</legend>
<div class="collapsible-content">
<button onclick="openDatasetLabels()">Enter Dataset Labels</button>
<button onclick="openSampleLabels()">Enter Sample Labels</button>
<button onclick="openChartModifiersModal()">Chart Modifiers</button>
<button onclick="openMapModifiersModal()">Map Modifiers</button>
<hr>
<div class="input-group">
<label for="primary-sorting-select">Primary Sort:</label>
<select id="primary-sorting-select"></select>
</div>
<div class="input-group">
<label for="secondary-sorting-select">Secondary Sort:</label>
<select id="secondary-sorting-select"></select>
</div>
</div>
</fieldset>
</aside>
<main class="output-area">
<button id="sidebar-toggle" onclick="toggleSidebar()">▶</button>
<div class="fixed-header-container">
<div id="sedDredgeData" style="display: none;"></div>
<div id="fileDisplay"></div>
<div id="sample-info-table-container"></div>
<div id="everything-maps" style="display: none; margin-top: 1rem;">
<div style="text-align: center; margin: 10px 0; display: flex; justify-content: center; gap: 10px;">
<button onclick="toggleFileDisplay()">Toggle File Display</button>
<button id="toggleTooltipsBtn" onclick="toggleAllTooltips()">Show All Sample Names</button>
<button id="toggleAreaTooltipsBtn" onclick="toggleAllAreaTooltips()">Show All Area Names</button>
<button onclick="openRadarSelectionModal()">Radar Plot Options</button>
<button id="toggleMapLegendBtn" onclick="toggleMapLegend()">Show Legend</button>
</div>
<div id="map" class="map-container-original"></div>
<div id="map-legend" class="map-legend-container" style="display: none;">
<h4>Legend</h4>
</div>
</div>
<div id="chart-tab-buttons" class="tab-buttons"></div>
</div>
<div class="scrollable-content">
<div id="charts-and-tables-container">
<div id="chartContainer"></div>
<div id="chartsForMapContainer"></div>
</div>
</div>
</main>
</div>
<!-- Modals -->
<div id="sedDataModal" class="modal">
<div class="modal-content">
<h2>Select CEFAS Data Sets</h2>
<div class="input-group"><label for="fileInputDD">CEFAS dredge data file</label><input type="file" id="fileInputDD" onchange="importDredgeData()"></div>
<div class="input-group"><label for="urlInputDD">CEFAS dredge data URL</label><input type="text" id="urlInputDD" placeholder="URL" onchange="importDredgeData()"></div>
<div class="input-group"><label for="mlApplications">MLA IDs (comma-separated)</label><input type="text" id="mlApplications" placeholder="e.g., MLA/2023/00123"></div>
<hr>
<div class="input-group"><label>Search by Area</label><input type="number" id="centreLatitude" placeholder="Center Latitude"><input type="number" id="centreLongitude" placeholder="Center Longitude"><input type="number" id="radius" placeholder="Radius (m)"></div>
<div class="input-group"><label>Search by Date</label><input type="date" id="startDate"><input type="date" id="finishDate"></div>
<div class="modal-footer"><button onclick="closeCEFASSearch()">Search CEFAS Selection</button><button onclick="closeCEFASSelection()" class="secondary">Finish & Close</button></div>
</div>
</div>
<div id="datasetModal" class="modal">
<div class="modal-content">
<h2>Filter Datasets</h2>
<p>Select datasets that <strong>must</strong> be present for a sample to be included.</p>
<div class="checkbox-group">
<label><input type="checkbox" id="tracemetaldataset"> Trace metal data</label>
<label><input type="checkbox" id="pahdataset"> PAH data</label>
<label><input type="checkbox" id="pcbdataset"> PCB data</label>
<label><input type="checkbox" id="bdedataset"> BDE data</label>
<label><input type="checkbox" id="organotinsdataset"> Organotins data</label>
<label><input type="checkbox" id="organochlorinedataset"> Organochlorine data</label>
<label><input type="checkbox" id="physicaldataset"> Physical data</label>
</div>
<div class="modal-footer"><button onclick="applyDatasetFilter()">Apply Dataset Selection</button></div>
</div>
</div>
<div id="sampleModal" class="modal">
<div class="modal-content">
<span class="close-button" onclick="cancelSampleSelection()">×</span>
<h2>Select Samples</h2>
<div style="display: flex; gap: 0.5rem; flex-wrap: wrap;">
<button onclick="flipSampleSelections(true)">Select All</button>
<button onclick="flipSampleSelections(false)">Select None</button>
<button onclick="selectHighlighted()">Select Highlighted</button>
</div>
<hr>
<p><strong>Filter Samples:</strong></p>
<div class="input-group">
<label for="areaSelect">Filter by Area:</label>
<select id="areaSelect" class="full-width-select" onchange="applyAreaFilter()">
<option value="">-- Select an Area --</option>
</select>
</div>
<div class="horizontal-group">
<label for="centreLat">Centre latitude:</label><input type="number" id="centreLat" placeholder="Leave blank for location">
<label for="centreLon">Centre longitude:</label><input type="number" id="centreLon" placeholder="Leave blank for location">
<label for="centreDist">Distance (m):</label><input type="number" id="centreDist" placeholder="Select 1 location">
</div>
<div class="horizontal-group">
<label for="minDepth">Minimum depth:</label><input type="number" id="minDepth">
<label for="maxDepth">Maximum depth:</label><input type="number" id="maxDepth">
</div>
<div class="input-group">
<label for="containsText">Filter by name (contains text):</label><input type="text" id="containsText">
</div>
<div>Must have measurement of - <input type="checkbox" id="tracemetaldatasample"><label for="tracemetaldatasample">Trace metal data</label>
<input type="checkbox" id="pahdatasample"><label for="pahdatasample">PAH data</label>
<input type="checkbox" id="pcbdatasample"><label for="pcbdatasample">PCB data</label>
<input type="checkbox" id="bdedatasample"><label for="bdedatasample">BDE data</label>
<input type="checkbox" id="organotinsdatasample"><label for="organotinsdatasample">Organotins data</label>
<input type="checkbox" id="organochlorinedatasample"><label for="organochlorinedatasample">Organochlorine data</label>
<input type="checkbox" id="physicaldatasample"><label for="physicaldatasample">Physical data</label>
</div>
<button onclick="applySampleFilter()">Apply Filter</button>
<hr>
<div id="sampleCheckboxes" style="max-height: 300px; overflow-y: auto; border: 1px solid var(--border-color); padding: 0.5rem; border-radius: 4px;"></div>
<div class="modal-footer">
<button onclick="cancelSampleSelection()" class="secondary">Cancel</button>
<button onclick="closeSampleSelection()">Confirm Selections and Close</button>
</div>
</div>
</div>
<div id="chemicalModal" class="modal">
<div class="modal-content">
<h2>Select Chemicals</h2>
<div style="display: flex; gap: 0.5rem; flex-wrap: wrap;"><button onclick="flipChemicalSelections(true)">Select All</button><button onclick="flipChemicalSelections(false)">Select None</button></div>
<hr>
<p><strong>Filter Chemicals:</strong></p>
<div class="input-group"><label for="containsTextChemical">Filter by name (contains text):</label><input type="text" id="containsTextChemical"></div>
<button onclick="applyChemicalFilter()">Apply Filter</button>
<hr>
<div id="chemicalCheckboxes" style="max-height: 300px; overflow-y: auto; border: 1px solid var(--border-color); padding: 0.5rem; border-radius: 4px;"></div>
<div class="modal-footer"><button onclick="closeChemicalSelection()">Confirm Selection</button></div>
</div>
</div>
<div id="datasetLabels" class="modal">
<div class="modal-content">
<h2>Enter Alternate Labels for Datasets</h2>
<form id="datasetLabelsForm"></form>
<div class="modal-footer"><button onclick="updateDatasetLabels()">Confirm Labels</button><button onclick="closeDatasetLabels()" class="secondary">Cancel</button></div>
</div>
</div>
<div id="sampleLabels" class="modal">
<div class="modal-content">
<h2>Enter Alternate Labels for Samples</h2>
<form id="sampleLabelsForm"></form>
<div class="modal-footer"><button onclick="updateSampleLabels()">Confirm Labels</button><button onclick="closeSampleLabels()" class="secondary">Cancel</button></div>
</div>
</div>
<div id="additionalInfoModal" class="modal">
<div class="modal-content">
<h2>Additional Information Files</h2>
<div class="input-group"><label for="fileLocations">Location co-ordinate files</label><input type="file" id="fileLocations" multiple><input type="text" id="urlLocations" placeholder="Enter comma-separated URLs"><button onclick="importLocations()">Import Locations</button></div>
<hr>
<div class="input-group"><label for="fileShapes">Shape files (kml)</label><input type="file" id="fileShapes" multiple><input type="text" id="urlShapes" placeholder="Enter comma-separated URLs"><button onclick="importShapes()">Import shape files</button></div>
<hr>
<div class="input-group"><label for="fileChemInfo">ChemInfo files</label><input type="file" id="fileChemInfo" multiple><input type="text" id="urlChemInfo" placeholder="Enter comma-separated URLs"><button onclick="importChemInfo()">Import Chem Info</button></div>
<div class="modal-footer"><button onclick="closeAdditionalInfoModal()" class="secondary">Close</button></div>
</div>
</div>
<div id="chartModifiersModal" class="modal">
<div class="modal-content">
<h2>Chart Modifiers</h2>
<div class="radio-group">
<label><input type="radio" name="look" id="colour" value="colour" checked> Colour</label>
<label><input type="radio" name="look" id="blackandwhite" value="blackandwhite"> Black and White</label>
</div>
<hr>
<div class="checkbox-group">
<label><input type="checkbox" id="useTabs" checked> Display charts in tabs</label>
</div>
<div class="checkbox-group">
<label><input type="checkbox" id="fixMap" onchange="toggleMapPosition()"> Fix map at top when scrolling</label>
</div>
<div class="modal-footer"><button onclick="closeChartModifiersModal()" class="secondary">Close</button></div>
</div>
</div>
<div id="mapModifiersModal" class="modal">
<div class="modal-content">
<h2>Map Modifiers</h2>
<label for="markerScaling">Marker Scaling Factor:</label><input type="number" id="markerScaling" placeholder="1" step="0.1" value="1">
<div class="modal-footer"><button onclick="closeMapModifiersModal()" class="secondary">Close</button></div>
</div>
</div>
<div id="additionalChartsModal" class="modal">
<div class="modal-content">
<h2>Additional Chart Options</h2>
<div class="checkbox-group">
<label><input type="checkbox" id="gorhamtest" checked> PAH - Gorham Test Protocol</label>
<label><input type="checkbox" id="totalhc" checked> PAH - Total hydrocarbons & Total PAHs/THC</label>
<label><input type="checkbox" id="pahratios" checked> PAH - Ratios</label>
<label><input type="checkbox" id="ringfractions" checked> PAH - Ring Fractions</label>
<label><input type="checkbox" id="eparatios" checked> PAH - EPA Ratios</label>
<label><input type="checkbox" id="simpleratios" checked> PAH - Simple Ratios</label>
<label><input type="checkbox" id="congenertest" checked> PCB - Congener test</label>
</div>
<div class="modal-footer"><button onclick="closeAdditionalChartsModal()" class="secondary">Close</button></div>
</div>
</div>
<div id="pcaOptionsModal" class="modal">
<div class="modal-content">
<h2>PCA Options</h2>
<div class="checkbox-group">
<label><input type="checkbox" id="pcanormalise" checked> Normalise to 100</label>
<label><input type="checkbox" id="pcalmw" checked> PAH LMW</label>
<label><input type="checkbox" id="pcahmw" checked> PAH HMW</label>
<label><input type="checkbox" id="pcaepa" checked> PAH EPA</label>
<label><input type="checkbox" id="pcasmallpts" checked> Small particles</label>
<label><input type="checkbox" id="pcaorganiccarbon" checked> Organic carbon</label>
</div>
<div class="modal-footer"><button onclick="closePcaOptionsModal()" class="secondary">Close</button></div>
</div>
</div>
<div id="particleSizeModal" class="modal">
<div class="modal-content">
<h2>Particle Size Details</h2>
<p>Resuspension by overflow % or particle size (µm)</p>
<div class="input-group"><label for="overflowpercent">Percentage overflow:</label><input type="number" id="overflowpercent" placeholder="0 set by pt size"></div>
<div class="input-group"><label for="resuspensionsize">Maximum resuspension size (µm):</label><input type="number" id="resuspensionsize" placeholder="0 set by overflow %"></div>
<div class="modal-footer"><button onclick="closeParticleSizeModal()" class="secondary">Close</button></div>
</div>
</div>
<div id="radarModal" class="modal">
<div class="modal-content">
<span class="close-button" onclick="closeRadarSelectionModal()">×</span>
<h2>Select Radar Plot for Map Popups</h2>
<p>Choose which dataset to display as a radar chart when you click on a map marker.</p>
<div id="radarPlots" class="radio-group"></div>
<div class="modal-footer">
<button onclick="closeRadarSelectionModal()" class="secondary">Close</button>
</div>
</div>
</div>
<script src="os-transform.js"></script>
<script src="sdeDataUtilities.js"></script>
<script src="sdeDredgeData.js"></script>
<script src="sdeStandards.js"></script>
<script src="SedimentDataExplorer.js"></script>
<script src="sdeCalcs4Charts.js"></script>
<script src="sdeCharts.js"></script>
<script src="sdeSelections.js"></script>
<script src="sdeMaps.js"></script>
<script src="sdeTables.js"></script>
<script>
function toggleMap() {
const mapContainer = document.getElementById('everything-maps');
const button = document.getElementById('toggleMapBtn');
if (mapContainer.style.display === 'none') {
mapContainer.style.display = 'block';
button.textContent = 'Hide Map';
} else {
mapContainer.style.display = 'none';
button.textContent = 'Show Map';
}
}
function toggleSidebar() {
const sidebar = document.getElementById('controls-sidebar');
const toggleBtn = document.getElementById('sidebar-toggle');
sidebar.classList.toggle('collapsed');
if (sidebar.classList.contains('collapsed')) {
toggleBtn.innerHTML = '▶';
toggleBtn.style.left = '10px';
} else {
toggleBtn.innerHTML = '◀';
toggleBtn.style.left = '364px';
}
}
function openTab(evt, tabName) {
// Get all elements with class="tab-content" and hide them
const tabcontent = document.getElementsByClassName("tab-content");
for (let i = 0; i < tabcontent.length; i++) {
tabcontent[i].style.display = "none";
}
// Get all elements with class="tab-button" and remove the class "active"
const tablinks = document.getElementsByClassName("tab-button");
for (let i = 0; i < tablinks.length; i++) {
tablinks[i].className = tablinks[i].className.replace(" active", "");
}
// Show the current tab, and add an "active" class to the button that opened the tab