From 549499a71a936ef7e78ae223aab09cbbcca8e253 Mon Sep 17 00:00:00 2001 From: Auggie Fisher Date: Wed, 10 Dec 2025 16:33:55 -0500 Subject: [PATCH] Add lines to graph and mini graph for this time prior days - Add vertical dotted orange lines to main graph for "this time" on prior days when scrolling back - Add vertical dotted orange lines to the mini graph for "this time" on prior days --- LoopFollow/Controllers/Graphs.swift | 35 +++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/LoopFollow/Controllers/Graphs.swift b/LoopFollow/Controllers/Graphs.swift index 9789e9c46..8c5076925 100644 --- a/LoopFollow/Controllers/Graphs.swift +++ b/LoopFollow/Controllers/Graphs.swift @@ -765,6 +765,41 @@ extension MainViewController { midnightTimeInterval = midnightTimeInterval.advanced(by: -24 * 60 * 60) } } + + // Draw "same time" lines on prior days (orange dotted lines) + createSameTimeLines() + } + + func createSameTimeLines() { + // Draw orange dotted lines at the current time of day on each prior day + // This helps visualize what was happening at this same time yesterday, etc. + let now = dateTimeUtils.getNowTimeIntervalUTC() + let graphHours = 24 * Storage.shared.downloadDays.value + let graphStart = dateTimeUtils.getTimeIntervalNHoursAgo(N: graphHours) + + // Start from 24 hours ago (yesterday at this time) and go back + var priorDayTime = now - (24 * 60 * 60) + + while priorDayTime > graphStart { + // Large chart - orange dotted line (same style as teal midnight lines) + let ul = ChartLimitLine() + ul.limit = Double(priorDayTime) + ul.lineColor = NSUIColor.systemOrange.withAlphaComponent(0.5) + ul.lineDashLengths = [CGFloat(2), CGFloat(5)] + ul.lineWidth = 1 + BGChart.xAxis.addLimitLine(ul) + + // Small chart - orange dotted line + let sl = ChartLimitLine() + sl.limit = Double(priorDayTime) + sl.lineColor = NSUIColor.systemOrange + sl.lineDashLengths = [CGFloat(2), CGFloat(2)] + sl.lineWidth = 1 + BGChartFull.xAxis.addLimitLine(sl) + + // Move back another 24 hours + priorDayTime = priorDayTime - (24 * 60 * 60) + } } func updateBGGraphSettings() {