feat(panel): 调整资源卡片读数布局并保留趋势平移
逐核显示 CPU 占用,在 GPU 标题展示核数并补充分项读数。无电池设备显示整机功率。 存储与网络将曲线排在详情下方,CPU、GPU、内存和电池保留整卡趋势。数值直接刷新,曲线随采样平滑平移。顶栏展示版本号,底栏调整开机时间和刷新间隔。
This commit is contained in:
@@ -8,7 +8,7 @@ enum TrendValueFormat {
|
||||
case watts
|
||||
}
|
||||
|
||||
/// Static curves skip missing vertices, retaining timestamps and explicit sampling breaks.
|
||||
/// Curves skip missing vertices, retaining timestamps and explicit sampling breaks.
|
||||
struct PanelTrendChart: View {
|
||||
let dates: [Date]
|
||||
let first: [Double?]
|
||||
@@ -31,8 +31,11 @@ struct PanelTrendChart: View {
|
||||
var boundaryDates: Set<Date> = []
|
||||
var intervals: [TimeInterval] = []
|
||||
var visibleSeriesCount = 1
|
||||
var filledSeriesCount: Int? = nil
|
||||
var stackOrder: [Int] = []
|
||||
var projection: PanelCurveProjection = .fullHeight
|
||||
@Environment(\.panelMotionActive) private var active
|
||||
@Environment(\.accessibilityReduceMotion) private var reduceMotion
|
||||
@State private var retainedScale: Double = 1
|
||||
@State private var smallSamples = 0
|
||||
@State private var retainedSecondScale: Double = 1
|
||||
@@ -115,7 +118,8 @@ struct PanelTrendChart: View {
|
||||
scales: [scale, hasSecondaryScale ? secondaryScale : scale, scale, scale],
|
||||
maximumGap: max(5, expectedInterval * 2), hoveredIndex: hoveredDate == nil ? nil : index,
|
||||
visibleSeriesCount: stackOrder.isEmpty ? visibleSeriesCount : stackOrder.count,
|
||||
filledSeriesCount: stackOrder.isEmpty ? visibleSeriesCount : stackOrder.count, stacked: !stackOrder.isEmpty, projection: projection)
|
||||
filledSeriesCount: stackOrder.isEmpty ? (filledSeriesCount ?? visibleSeriesCount) : stackOrder.count, stacked: !stackOrder.isEmpty, projection: projection,
|
||||
animates: active && !reduceMotion)
|
||||
.contentShape(Rectangle())
|
||||
.onContinuousHover { phase in
|
||||
switch phase {
|
||||
|
||||
Reference in New Issue
Block a user