feat(ui): 趋势图跳过无值节点并接续有效数据

This commit is contained in:
2026-11-07 15:04:06 +08:00
parent 050ee30f56
commit 7f3f573e7c
16 changed files with 70 additions and 16 deletions
+2 -1
View File
@@ -17,8 +17,9 @@ nonisolated enum PanelCurveGeometry {
var run: [Sample] = []
func flush() { if !run.isEmpty { result.append(run); run.removeAll(keepingCapacity: true) } }
for index in dates.indices {
guard index < values.count, let value = values[index], value.isFinite else { flush(); continue }
if index > 0 && (boundaryDates.contains(dates[index]) || dates[index].timeIntervalSince(dates[index - 1]) > allowedGap(at: index, intervals: intervals, fallback: maximumGap) || dates[index] <= dates[index - 1]) { flush() }
// Missing values do not create vertices, but their timestamps can still carry a real break.
guard index < values.count, let value = values[index], value.isFinite else { continue }
run.append(Sample(date: dates[index], value: value))
}
flush()