Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions LoopFollow/Controllers/Graphs.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
Loading