Skip to content

Commit da17208

Browse files
committed
Correct orphaned tables consuming screen space
1 parent 6a812a3 commit da17208

3 files changed

Lines changed: 24 additions & 3 deletions

File tree

SedimentDataExplorer.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,9 +207,11 @@ <h2>Select Chemicals</h2>
207207
<label for="relationorganiccarbon">Organic Carbon</label>
208208
</div>
209209
<div>
210-
Resuspension -
210+
Resuspension by overflow % or particle size (µm) -
211+
<label for="overflowpercent">Percentage overflow:</label>
212+
<input type="number" id="overflowpercent" placeholder="0 set by pt size">
211213
<label for="resuspensionsize">Maximum resuspension size (µm):</label>
212-
<input type="number" id="resuspensionsize" placeholder="0 for no resuspension">
214+
<input type="number" id="resuspensionsize" placeholder="0 set by overflow %">
213215
</div>
214216
<div>
215217
PAH specific

sdeCalcs4Charts.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ function propertyChartSort(measChart) {
217217
function dataForPSDCharting(sheetName) {
218218
let datesSampled = Object.keys(selectedSampleMeasurements);
219219
let ct = sheetName;
220+
console.log('dataForPSD ',ct,blankSheets);
220221
let unitTitle = blankSheets[ct]['Unit of measurement'];
221222
let measChart = {};
222223
let measChartArea = {};
@@ -231,6 +232,7 @@ function dataForPSDCharting(sheetName) {
231232
let cumAreas = {};
232233
//srg250308 datesSampled.sort();
233234
datesSampled.forEach (ds => {
235+
//console.log(ds);
234236
if (!(selectedSampleMeasurements[ds][ct] == undefined || selectedSampleMeasurements[ds][ct] == null)) {
235237
ptsSizes = selectedSampleMeasurements[ds][ct].sizes;
236238
ptsSizes = ptsSizes.map(phiSize => Math.pow(2, -phiSize)/1000);

sdeCharts.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ function updateChart(){
4646
//console.log('UPDATECHART*******************');
4747
if (lastInstanceNo > 0) {
4848
const canvas = [];
49+
removeScatterTables();
4950
for (i = 1; i < lastInstanceNo + 1; i++) {
5051
canvas[i] = document.getElementById('chart' + i);
5152
clearCanvasAndChart(canvas[i], i);
@@ -184,7 +185,7 @@ function createResetChart(instanceNo) {
184185

185186

186187
function displayCharts(sheetName, instanceNo) {
187-
// totalAreasAvailable = true;
188+
// totalAreasAvailable = true;
188189
if(sheetName === 'Physical Data') {
189190
retData = dataForPSDCharting(sheetName);
190191
unitTitle = retData['unitTitle'];
@@ -479,6 +480,22 @@ console.log('PAH data reset');
479480
return instanceNo
480481
}
481482

483+
function removeScatterTables() {
484+
const chartContainer = document.getElementById('chartContainer');
485+
486+
// Remove all tables inside chartContainer
487+
const tables = chartContainer.getElementsByTagName('table');
488+
while (tables.length > 0) {
489+
tables[0].remove();
490+
}
491+
492+
// Optionally, remove the button container if it exists
493+
const buttonContainer = document.getElementById('chartButtons');
494+
if (buttonContainer) {
495+
buttonContainer.remove();
496+
}
497+
}
498+
482499
function displayScatterCharts(sheetName, chartType, subsKey, xAxisLabel, yAxisLabel, containerId, instanceNo) {
483500
//console.log('Sheet Name ',sheetName, 'chartType ', chartType, 'subsKey', subsKey, 'xAxisLael', xAxisLabel, 'yAxisLabel', yAxisLabel, 'containerId', containerId, 'instanceNo', instanceNo);
484501
if (subsToDisplay[subsKey] && completeSheet[chartType.sheetKey]) {

0 commit comments

Comments
 (0)