Skip to content

Commit 99981c4

Browse files
committed
more changes
1 parent 7741475 commit 99981c4

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

js/tracker.js

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -832,6 +832,8 @@ function drawHistorical (data, station) {
832832
var time = landing.datetime;
833833

834834
if (!historicalPlots[station].sondes.hasOwnProperty(serial)) {
835+
// Using age to detmine colour
836+
/*
835837
const date = new Date(time);
836838
var minTime = historicalPlots[station].data.minTime;
837839
var actualTime = date.getTime();
@@ -841,9 +843,23 @@ function drawHistorical (data, station) {
841843
842844
historicalPlots[station].sondes[serial].time = actualTime
843845
844-
// Calculate normalised time between 0 and 1
845846
var normalisedTime = ((actualTime-minTime)/(maxTime-minTime));
846847
var iconColour = ConvertRGBtoHex(evaluate_cmap(normalisedTime, 'turbo'));
848+
*/
849+
850+
// Using last known alt to detmine colour
851+
var minAlt = 0;
852+
var actualAlt = landing.alt;
853+
var maxAlt = 10000;
854+
855+
if (actualAlt > maxAlt) {
856+
actualAlt = maxAlt;
857+
} else if (actualAlt < minAlt) {
858+
actualAlt = minAlt;
859+
}
860+
861+
var normalisedAlt = ((actualAlt-minAlt)/(maxAlt-minAlt));
862+
var iconColour = ConvertRGBtoHex(evaluate_cmap(normalisedAlt, 'turbo'));
847863

848864
// Check if we have recovery data for it
849865
var recovered = false;

0 commit comments

Comments
 (0)