From 145cdbec5f7e404976a707410622c6ac2ba451b8 Mon Sep 17 00:00:00 2001 From: Anthony Castronova Date: Fri, 26 Jun 2026 15:09:23 -0400 Subject: [PATCH] removed date sorting logic causing problems due to no_data values within the time_str variable. This was causing the datetimes to become misaligned with the data, creating incorrect plots --- frontend/src/stores/charts.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/frontend/src/stores/charts.js b/frontend/src/stores/charts.js index 3c3af58..2956c3c 100644 --- a/frontend/src/stores/charts.js +++ b/frontend/src/stores/charts.js @@ -531,11 +531,14 @@ export const useChartsStore = defineStore( for (const key in propertyObject) { let values = propertyObject[key] if (key == 'time_str') { + //convert time_str to Date objects and filter out any 'no_data' values + const validTimes = values.filter((t) => t !== 'no_data').map((t) => new Date(t)) + // set the min and max date times - // time_str should be in order but we make sure - values.sort() - minDateTime = new Date(values[0]) - maxDateTime = new Date(values[values.length - 1]) + if (validTimes.length > 0) { + minDateTime = new Date(Math.min(...validTimes)) + maxDateTime = new Date(Math.max(...validTimes)) + } } values.forEach((value, i) => { if (measurements[i] == null) {