feat(ui): 实现全卡堆叠趋势与单页资源进程布局
This commit is contained in:
@@ -99,10 +99,40 @@ import QuartzCore
|
||||
plot.configure(.init(frame: PanelCurveFrame(dates: dates, series: [[nil,nil,nil,nil], [0.5,0.5,0.5,0.5]],
|
||||
intervals: [2,2,2,2], boundaryDates: []), colors: [.red], scales: [1], maximumGap: 5))
|
||||
precondition(redPixels(bitmap(plot), from: 0.4, to: 0.6) > 10)
|
||||
// Distinct cumulative bands must meet at 30%, with 70% total at the full plot scale.
|
||||
var stack = NativePanelCurve.Input(frame: .init(dates: dates,
|
||||
series: [Array(repeating: 0.3, count: 4), Array(repeating: 0.4, count: 4)],
|
||||
intervals: [2,2,2,2], boundaryDates: []), colors: [.red,.blue], scales: [1], maximumGap: 5,
|
||||
filledSeriesCount: 2, stacked: true)
|
||||
plot.configure(stack)
|
||||
let upperArea = (plot.curves.sublayers![1].sublayers![0] as! CAShapeLayer).path!.boundingBoxOfPath
|
||||
precondition(abs(upperArea.minY - 18) < 1e-9 && abs(upperArea.maxY - 42) < 1e-9,
|
||||
"The upper component must fill only between cumulative boundaries")
|
||||
let stackedBitmap = bitmap(plot)
|
||||
var redBand = 0, blueBand = 0
|
||||
for y in 0..<stackedBitmap.pixelsHigh {
|
||||
let c = stackedBitmap.colorAt(x: stackedBitmap.pixelsWide / 2, y: y)!.usingColorSpace(.deviceRGB)!
|
||||
guard c.alphaComponent > 0.1 && c.alphaComponent < 0.18 else { continue }
|
||||
if c.redComponent > c.blueComponent + 0.2 { redBand += 1 }
|
||||
if c.blueComponent > c.redComponent + 0.2 { blueBand += 1 }
|
||||
}
|
||||
precondition(redBand > 20 && blueBand > 30, "Both components must produce separate translucent area pixels")
|
||||
let stackedBuilds = plot.pathBuildCount
|
||||
stack.hoveredIndex = 1; plot.configure(stack)
|
||||
let cumulativeDot = plot.layer!.sublayers!.last as! CAShapeLayer
|
||||
precondition(abs(cumulativeDot.path!.boundingBoxOfPath.midY - 18) < 1e-9)
|
||||
precondition(plot.pathBuildCount == stackedBuilds)
|
||||
stack = .init(frame: .init(dates: dates,
|
||||
series: [Array(repeating: 0.3, count: 4), Array(repeating: 0.4, count: 4)],
|
||||
intervals: [2,2,2,2], boundaryDates: [dates[2]]), colors: [.red,.blue], scales: [1], maximumGap: 5,
|
||||
filledSeriesCount: 2, stacked: true)
|
||||
plot.configure(stack)
|
||||
precondition(redPixels(bitmap(plot), from: 0.4, to: 0.6) == 0,
|
||||
"Every stack band must respect the same real sampling break")
|
||||
assertStatic(plot.layer!)
|
||||
plot.removeFromSuperview()
|
||||
window.orderOut(nil); window.close()
|
||||
print("PASS: static background lines/area pixels, no single-point fill, hidden-series isolation, immediate stable updates, no animation/material/gradient layers, real gaps, hover cache, palette growth, appearance, full history and unmount")
|
||||
print("PASS: stacked component pixels and cumulative hover, static background lines/area pixels, no single-point fill, hidden-series isolation, immediate stable updates, no animation/material/gradient layers, real gaps, hover cache, palette growth, appearance, full history and unmount")
|
||||
fflush(stdout); NSApp.terminate(nil)
|
||||
}
|
||||
NSApp.run()
|
||||
|
||||
Reference in New Issue
Block a user