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
+11 -1
View File
@@ -28,7 +28,17 @@ import QuartzCore
plot.needsDisplay = false; plot.configure(continuous)
precondition(!plot.needsDisplay, "Identical inputs must not invalidate the plot")
plot.configure(input([0.8,0.8,nil,0.8]))
precondition(redPixels(bitmap(plot), from: 0.4, to: 0.6) == 0, "Missing values must leave a real gap")
precondition(redPixels(bitmap(plot), from: 0.4, to: 0.6) > 10, "Missing vertices must connect the surrounding valid points")
plot.configure(input([0.8,nil,.nan,0.8]))
precondition(redPixels(bitmap(plot), from: 0.4, to: 0.6) > 10)
plot.configure(.init(frame: .init(dates: dates, series: [[0.8,nil,nil,0.8]],
intervals: [2,2,2,2], boundaryDates: [dates[2]]), colors: [.red], scales: [1], maximumGap: 5))
precondition(redPixels(bitmap(plot), from: 0.4, to: 0.6) == 0,
"A pause boundary on a missing vertex must still leave a real gap")
var missingHover = input([0.8,0.8,nil,0.8]); missingHover.hoveredIndex = 2
plot.configure(missingHover)
let dots = plot.layer!.sublayers!.last as! CAShapeLayer
precondition(dots.path == nil, "Connecting a missing value must not invent a measured hover dot")
plot.configure(input([nil,nil,nil,nil]))
precondition(redPixels(bitmap(plot)) == 0)
let changedDates = [0.0, 2, 8, 10].map { Date(timeIntervalSinceReferenceDate: $0) }