Skip to content

Commit 0eb96f4

Browse files
committed
Allows selection of samples that have specific types of measurements.
1 parent 49eaa92 commit 0eb96f4

7 files changed

Lines changed: 239 additions & 148 deletions

SedimentDataExplorer.html

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -373,21 +373,42 @@
373373
height: 18px;
374374
margin-right: 8px;
375375
}
376-
.scatter-flex-container {
376+
377+
378+
.scatter-chart-wrapper {
379+
position: relative;
380+
width: 100%;
381+
height: 400px; /* Set a fixed height or use min-height */
382+
flex: 1; /* If using flexbox */
383+
}
384+
385+
.scatter-chart-wrapper canvas {
386+
width: 100% !important;
387+
height: 100% !important;
388+
}
389+
390+
.scatter-flex-container {
391+
display: flex;
392+
flex-wrap: wrap;
393+
gap: 20px;
394+
}
395+
396+
.scatter-flex-container {
377397
display: flex;
378398
flex-wrap: wrap;
379399
/* gap: 1rem; /* Adds space between charts */
380400
}
381401

382402
.scatter-chart-wrapper {
383403
flex: 1 1 100%; /* Default to full width on small screens */
384-
flex-grow: 0; /* This prevents items from growing to fill space */
385-
flex-shrink: 0;
404+
/*flex-grow: 0; This prevents items from growing to fill space */
405+
/* flex-shrink: 0;*/
386406
min-width: 140px; /* Prevents charts from becoming too small */
387407
/* height: 300px; /* Crucial: Gives the container a height */
388408
position: relative; /* Required for Chart.js responsiveness */
389409
}
390410

411+
391412
/* Media queries for responsive columns */
392413
@media (min-width: 768px) {
393414
.scatter-chart-wrapper {
@@ -687,14 +708,21 @@ <h2>Select Samples</h2>
687708
<label for="maxDepth">Maximum depth:</label><input type="number" id="maxDepth">
688709
<label for="containsText">Filter by name (contains text):</label><input type="text" id="containsText">
689710
</div>
711+
<div>Must have measurement of - <input type="checkbox" id="tracemetaldatasample"><label for="tracemetaldatasample">Trace metal data</label>
712+
<input type="checkbox" id="pahdatasample"><label for="pahdatasample">PAH data</label>
713+
<input type="checkbox" id="pcbdatasample"><label for="pcbdatasample">PCB data</label>
714+
<input type="checkbox" id="bdedatasample"><label for="bdedatasample">BDE data</label>
715+
<input type="checkbox" id="organotinsdatasample"><label for="organotinsdatasample">Organotins data</label>
716+
<input type="checkbox" id="organochlorinedatasample"><label for="organochlorinedatasample">Organochlorine data</label>
717+
<input type="checkbox" id="physicaldatasample"><label for="physicaldatasample">Physical data</label>
718+
</div>
690719
<button onclick="applySampleFilter()">Apply Filter</button>
691720
<hr>
692721
<div id="sampleCheckboxes" style="max-height: 300px; overflow-y: auto; border: 1px solid var(--border-color); padding: 0.5rem; border-radius: 4px;"></div>
693722
<div class="modal-footer">
694723
<button onclick="cancelSampleSelection()" class="secondary">Cancel</button>
695724
<button onclick="closeSampleSelection()">Confirm Selections and Close</button>
696725
</div>
697-
<div>Must have non-zero - <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>
698726
</div>
699727
</div>
700728
<div id="chemicalModal" class="modal">

SedimentDataExplorer.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,9 @@
120120
'Total Hydrocarbon', 'Gorham LMW Sum', 'Gorham HMW Sum', 'ICES7 PCB Sum'
121121
];
122122

123-
const primarySortingOptions = ['None', 'Date of Sampling', 'Sample Name', 'Date & Sample Name'];
123+
const primarySortingOptions = [
124+
'None', 'Date of Sampling', 'Sample Name', 'Date & Sample Name', 'Sample Name & Date',
125+
'Dataset Name', 'Dataset Name & Sample Name ', 'Sample Name & Dataset Name'];
124126
const secondarySortingOptions = [
125127
'Latitude', 'Longitude', 'Min Depth', 'Max Depth', 'Mean Depth',
126128
'Total Area', 'Total Solids', 'Organic Matter',
@@ -1137,7 +1139,7 @@ fred = df;
11371139
//fred = sampleMeasurements[dateSampled]['Physical Data'].samples[allSamples[0]];
11381140
// if (!sampleMeasurements[dateSampled]['Physical Data'].samples[allSamples[0]]['Total solids (% total sediment)']) {
11391141
// if (sampleMeasurements[dateSampled]['Physical Data'].samples[allSamples[0]]['Total solids (% total sediment)'] === undefined) {
1140-
console.log('New test: No total solids');
1142+
console.log('New test: No total solids',dateSampled, sheetName);
11411143
// Code that reads Total Solids column into physical data
11421144
if (!('Total solids (% total sediment)' in sampleMeasurements[dateSampled]['Physical Data'].samples[allSamples[0]])) {
11431145
col = startCol + 3;
@@ -1198,14 +1200,16 @@ let missingTotalSolids = true;
11981200
if (df[startRow - 3][startCol + 4].includes('Exempt')) {
11991201
deltaExempt = 1;
12001202
}
1203+
let blankLine = 0;
12011204
for (let col = startCol + 6 + deltaExempt; col < df[startRow - 1].length; col++) {
12021205
meas.sizes.push(parseFloat(df[startRow - 2][col]) || 0);
1203-
for (let row = startRow; row < 38; row++) {
1206+
for (let row = startRow; row < df.length; row++) {
12041207
sample = df[row][startCol + 2]; //bodge to pick up sample id
12051208
// If sample id not present then use Laboratory sample number instead
12061209
if (sample == undefined || sample == null) {
12071210
sample = df[row][startCol];
12081211
}
1212+
//Stop if no sample id - end of data - may break if blank rows in data
12091213
if (!(sample == undefined || sample == null)) {
12101214
//console.log(sheetName, col, row, sample);
12111215
if (!meas.samples) {
@@ -1237,6 +1241,11 @@ let missingTotalSolids = true;
12371241
//console.log(sample);
12381242
meas.samples[sample].psd.push(parseFloat(df[row][col]) || 0);
12391243
//console.log('meas.psd ',df[row][col]);
1244+
} else {
1245+
blankLine += 1;
1246+
if (blankLine > 5) { // Allow for up to 5 blank lines in PSD data
1247+
break;
1248+
}
12401249
}
12411250
}
12421251
}

sdeCalcs4Charts.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ function dataForTotalScatterCharting(sheetName, chartType) {
452452
//let xValue;
453453
switch (chartType) {
454454
case "totalArea":
455-
//console.log(ds,s);
455+
console.log(ds,s);
456456
xValue = sampleMeasurements[ds]['Physical Data'].samples[s].totalArea;
457457
break;
458458

0 commit comments

Comments
 (0)