Skip to content

Commit dc6b0f7

Browse files
committed
Corrected normal sorting by name or label in the chart data
1 parent b4bf7cd commit dc6b0f7

3 files changed

Lines changed: 27 additions & 20 deletions

File tree

sdeCalcs4Charts.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,9 @@ function dataForCharting(sheetName) {
180180
});
181181
unitTitle = blankSheets[ct]['Unit of measurement'];
182182
//console.log(sheetName,measChart);
183-
if (!(xAxisSort === 'normal')) {
183+
// if (!(xAxisSort === 'normal')) {
184184
measChart = measChartSort(measChart);
185-
}
185+
// }
186186
//console.log(measChart);
187187
return { unitTitle, measChart }
188188
}
@@ -414,10 +414,10 @@ testOne = selectedSampleMeasurements[ds];
414414
}
415415
});
416416
//console.log(measChart);
417-
if (!(xAxisSort === 'normal')) {
417+
// if (!(xAxisSort === 'normal')) {
418418
measChart = propertyChartSort(measChart);
419419
//console.log(measChart);
420-
}
420+
// }
421421
return measChart
422422
}
423423

@@ -453,10 +453,10 @@ allSamples.sortSamples(ds,'totalArea');
453453
}
454454
});
455455
//console.log(measChart);
456-
if (!(xAxisSort === 'normal')) {
456+
// if (!(xAxisSort === 'normal')) {
457457
measChart = propertyChartSort(measChart);
458458
//console.log(measChart);
459-
}
459+
// }
460460
return measChart
461461
}
462462

@@ -510,11 +510,11 @@ function sumsForTotalHCCharting() {
510510
});
511511
//console.log(measChart);
512512
//console.log(xAxisSort);
513-
if (!(xAxisSort === 'normal')) {
513+
// if (!(xAxisSort === 'normal')) {
514514
//console.log(measChart);
515515
measChart = propertyChartSort(measChart);
516516
//console.log(Object.keys(measChart));
517-
}
517+
// }
518518
//console.log(measChart);
519519
return { unitTitle, measChart }
520520
}
@@ -561,9 +561,9 @@ function ratiosForPAHs() {
561561
}
562562
});
563563
//console.log('ratios',measChart);
564-
if (!(xAxisSort === 'normal')) {
564+
//if (!(xAxisSort === 'normal')) {
565565
measChart = propertyChartSort(measChart);
566-
}
566+
//}
567567
return {unitTitle, measChart}
568568
}
569569

@@ -609,9 +609,9 @@ function simpleRatiosForPAHs() {
609609
}
610610
});
611611
//console.log('ratios',measChart);
612-
if (!(xAxisSort === 'normal')) {
612+
//if (!(xAxisSort === 'normal')) {
613613
measChart = propertyChartSort(measChart);
614-
}
614+
//}
615615
return {unitTitle, measChart}
616616
}
617617

@@ -652,9 +652,9 @@ function epaRatiosForPAHs() {
652652
}
653653
});
654654
//console.log('ratios',measChart);
655-
if (!(xAxisSort === 'normal')) {
655+
//if (!(xAxisSort === 'normal')) {
656656
measChart = propertyChartSort(measChart);
657-
}
657+
//}
658658
return {unitTitle, measChart}
659659
}
660660

@@ -701,9 +701,9 @@ function ringFractionsForPAHs() {
701701
}
702702
});
703703
//console.log('ratios',measChart);
704-
if (!(xAxisSort === 'normal')) {
704+
//if (!(xAxisSort === 'normal')) {
705705
measChart = propertyChartSort(measChart);
706-
}
706+
//}
707707
return {unitTitle, measChart}
708708
}
709709

sdeCharts.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1601,9 +1601,9 @@ console.log('createHighlights',hoveredSample,dateSampled);
16011601
// }
16021602
});
16031603
//This needs the new sorting logic *************************************************************************
1604-
if (!(xAxisSort === 'normal')) {
1604+
// if (!(xAxisSort === 'normal')) {
16051605
samples.sortComplexSamples();
1606-
}
1606+
// }
16071607
//console.log(samples, hoveredSample);
16081608
if (!dateSampled) {
16091609
clickedSamples = findSamplesInSameLocation(hoveredSample);

sdeDataUtilities.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,16 @@ Array.prototype.sortComplexSamples = function() {
4444
if (partsB.length >2) {
4545
partsB[1] = partsB[1] + ': ' + partsB[2];
4646
}
47-
selectedSampleInfo[partsA[0]].position[partsA[1]]
47+
// selectedSampleInfo[partsA[0]].position[partsA[1]]
4848
//console.log(partsA);
4949
//console.log(partsB);
50+
51+
// Sorting by datesampled and label
52+
if (xAxisSort === 'normal') {
53+
const valueA = (selectedSampleInfo[partsA[0]]['label'] + selectedSampleInfo[partsA[0]].position[partsA[1]]['label']).toLowerCase();
54+
const valueB = (selectedSampleInfo[partsB[0]]['label'] + selectedSampleInfo[partsB[0]].position[partsB[1]]['label']).toLowerCase();
55+
return valueA.localeCompare(valueB);
56+
}
5057
// Sorting by latitude
5158
if (xAxisSort === 'latitude') {
5259
const valueA = selectedSampleInfo[partsA[0]].position[partsA[1]]['Position latitude'];
@@ -171,7 +178,7 @@ Array.prototype.sortComplexSamples = function() {
171178

172179
// Sorting by datetototalarea
173180
if (xAxisSort === 'datetotalarea') {
174-
console.log('datetotalarea');
181+
//console.log('datetotalarea');
175182
if (partsA[0] === partsB[0]) {
176183
const valueA = selectedSampleMeasurements[partsA[0]]['Physical Data'].samples[partsA[1]].totalArea;
177184
const valueB = selectedSampleMeasurements[partsB[0]]['Physical Data'].samples[partsB[1]].totalArea;

0 commit comments

Comments
 (0)