From 549499a71a936ef7e78ae223aab09cbbcca8e253 Mon Sep 17 00:00:00 2001 From: Auggie Fisher Date: Wed, 10 Dec 2025 16:33:55 -0500 Subject: [PATCH 1/3] 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() { From 43d8f7e84da79234fa262712e48251398c7569ec Mon Sep 17 00:00:00 2001 From: aug0211 <659845+aug0211@users.noreply.github.com> Date: Fri, 8 May 2026 10:59:21 -0400 Subject: [PATCH 2/3] White space cleanup - Removed unneeded empty lines --- LoopFollow/Controllers/Graphs.swift | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/LoopFollow/Controllers/Graphs.swift b/LoopFollow/Controllers/Graphs.swift index 8c5076925..7666686f8 100644 --- a/LoopFollow/Controllers/Graphs.swift +++ b/LoopFollow/Controllers/Graphs.swift @@ -765,21 +765,21 @@ 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() @@ -788,7 +788,7 @@ extension MainViewController { 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) @@ -796,7 +796,7 @@ extension MainViewController { sl.lineDashLengths = [CGFloat(2), CGFloat(2)] sl.lineWidth = 1 BGChartFull.xAxis.addLimitLine(sl) - + // Move back another 24 hours priorDayTime = priorDayTime - (24 * 60 * 60) } From 34a785d5669666df55634c385e6c8395f24f9eea Mon Sep 17 00:00:00 2001 From: aug0211 <659845+aug0211@users.noreply.github.com> Date: Thu, 17 Sep 2026 15:01:23 +0000 Subject: [PATCH 3/3] Put prior-day time lines behind a Graph Settings toggle The vertical dotted orange lines marking the current time on prior days rendered unconditionally on both the main and mini graphs. Gate them on a new "Show Prior Day Time Lines" toggle in Graph Settings, defaulting to off, so they behave like Show Midnight Lines and the other time markers. The new storage key is unset for existing users, which reads as false, so the lines are hidden until explicitly enabled. --- LoopFollow/Charts/BGChartModel.swift | 2 ++ LoopFollow/Charts/BGChartView.swift | 4 +++- LoopFollow/Settings/GraphSettingsView.swift | 4 ++++ LoopFollow/Settings/SettingsMenuView.swift | 1 + LoopFollow/Storage/Storage.swift | 1 + 5 files changed, 11 insertions(+), 1 deletion(-) diff --git a/LoopFollow/Charts/BGChartModel.swift b/LoopFollow/Charts/BGChartModel.swift index 27cb003ee..37091fb68 100644 --- a/LoopFollow/Charts/BGChartModel.swift +++ b/LoopFollow/Charts/BGChartModel.swift @@ -180,6 +180,7 @@ final class BGChartModel: ObservableObject { @Published var show90Min: Bool = false @Published var showMidnight: Bool = false @Published var smallGraphTreatments: Bool = true + @Published var showPriorDayTime: Bool = false private static let doseFormatter: NumberFormatter = { let nf = NumberFormatter() @@ -412,6 +413,7 @@ final class BGChartModel: ObservableObject { show90Min = Storage.shared.show90MinLine.value showMidnight = Storage.shared.showMidnightLines.value smallGraphTreatments = Storage.shared.smallGraphTreatments.value + showPriorDayTime = Storage.shared.showPriorDayTimeLines.value // Advanced-settings visibility toggles. The Nightscout controllers // collect the data regardless (it also feeds the info rows), so hidden diff --git a/LoopFollow/Charts/BGChartView.swift b/LoopFollow/Charts/BGChartView.swift index a28aaef65..1b7dc9407 100644 --- a/LoopFollow/Charts/BGChartView.swift +++ b/LoopFollow/Charts/BGChartView.swift @@ -1095,7 +1095,9 @@ private struct BGChartCanvas: View, Equatable { if showTreatments { treatmentMarks } - priorDayTimeRuleMarks + if model.showPriorDayTime { + priorDayTimeRuleMarks + } if !isSmall { ruleMarks } else if model.showMidnight { diff --git a/LoopFollow/Settings/GraphSettingsView.swift b/LoopFollow/Settings/GraphSettingsView.swift index 07d9d8d91..7efb38c40 100644 --- a/LoopFollow/Settings/GraphSettingsView.swift +++ b/LoopFollow/Settings/GraphSettingsView.swift @@ -12,6 +12,7 @@ struct GraphSettingsView: View { @ObservedObject private var show30MinLine = Storage.shared.show30MinLine @ObservedObject private var show90MinLine = Storage.shared.show90MinLine @ObservedObject private var showMidnightLines = Storage.shared.showMidnightLines + @ObservedObject private var showPriorDayTimeLines = Storage.shared.showPriorDayTimeLines @ObservedObject private var showYesterdayLine = Storage.shared.showYesterdayLine @ObservedObject private var smallGraphTreatments = Storage.shared.smallGraphTreatments @@ -50,6 +51,9 @@ struct GraphSettingsView: View { Toggle("Show Midnight Lines", isOn: $showMidnightLines.value) .onChange(of: showMidnightLines.value) { _ in markDirty() } + + Toggle("Show Prior Day Time Lines", isOn: $showPriorDayTimeLines.value) + .onChange(of: showPriorDayTimeLines.value) { _ in markDirty() } } // ── Treatments ─────────────────────────────────────────────── diff --git a/LoopFollow/Settings/SettingsMenuView.swift b/LoopFollow/Settings/SettingsMenuView.swift index 38fb991fb..93fd0fd93 100644 --- a/LoopFollow/Settings/SettingsMenuView.swift +++ b/LoopFollow/Settings/SettingsMenuView.swift @@ -176,6 +176,7 @@ enum SettingsRoute: Hashable, Identifiable { SettingsLeaf("Show −90 min Line", ["-90"]), SettingsLeaf("Show Yesterday's BG", ["yesterday"]), SettingsLeaf("Show Midnight Lines"), + SettingsLeaf("Show Prior Day Time Lines", ["prior day", "same time", "yesterday"]), SettingsLeaf("Show Carb/Bolus Values", ["carbs"]), SettingsLeaf("Show Carb Absorption"), SettingsLeaf("Treatments on Small Graph"), diff --git a/LoopFollow/Storage/Storage.swift b/LoopFollow/Storage/Storage.swift index 4876924e2..32f099148 100644 --- a/LoopFollow/Storage/Storage.swift +++ b/LoopFollow/Storage/Storage.swift @@ -128,6 +128,7 @@ class Storage { var show30MinLine = StorageValue(key: "show30MinLine", defaultValue: false) var show90MinLine = StorageValue(key: "show90MinLine", defaultValue: false) var showMidnightLines = StorageValue(key: "showMidnightMarkers", defaultValue: false) + var showPriorDayTimeLines = StorageValue(key: "showPriorDayTimeMarkers", defaultValue: false) var showYesterdayLine = StorageValue(key: "showYesterdayLine", defaultValue: false) var smallGraphTreatments = StorageValue(key: "smallGraphTreatments", defaultValue: true)