feat(ui): 趋势图跳过无值节点并接续有效数据
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user