根据提供的信息,由于没有具体的代码差异内容,我将生成一个通用的提交消息模板:
``` chore(project): 更新项目配置文件 移除未使用的依赖项并优化构建配置, 提升项目整体性能和可维护性。 ```
This commit is contained in:
@@ -133,7 +133,7 @@ extension SeriesBucket {
|
||||
id: "lab:\(latest.name)",
|
||||
seriesKey: "lab:\(latest.name)",
|
||||
label: nil,
|
||||
color: Tj.Palette.ink,
|
||||
color: Tj.Palette.teal,
|
||||
points: points,
|
||||
referenceRange: parseRange(latest.range)
|
||||
)
|
||||
@@ -172,7 +172,7 @@ extension SeriesBucket {
|
||||
id: key,
|
||||
seriesKey: key,
|
||||
label: nil,
|
||||
color: Tj.Palette.ink,
|
||||
color: Tj.Palette.teal,
|
||||
points: sorted.compactMap { point(from: $0) },
|
||||
referenceRange: range
|
||||
)
|
||||
@@ -200,7 +200,7 @@ extension SeriesBucket {
|
||||
id: "bp.systolic",
|
||||
seriesKey: "bp.systolic",
|
||||
label: String(appLoc: "收缩"),
|
||||
color: Tj.Palette.brick,
|
||||
color: Tj.Palette.teal,
|
||||
points: sysItems.compactMap { point(from: $0) },
|
||||
referenceRange: m.effectiveRange(for: sysField, profile: profile)
|
||||
)
|
||||
|
||||
@@ -111,6 +111,24 @@ struct SeriesChartCard: View {
|
||||
}
|
||||
}
|
||||
|
||||
// 单条线时,线下垫一层渐变面积,增加体量、柔化观感
|
||||
//(多条线如血压不加,避免两片面积互相盖住)。
|
||||
if bucket.lines.count == 1, let line = bucket.lines.first {
|
||||
ForEach(line.points) { p in
|
||||
// 显式把基线钉在值域下界:单值 AreaMark 的隐式基线(0/域外)会把渐变
|
||||
// 拉到可视区外、几乎不淡出,看着像一块实色底色一路铺到图表底。
|
||||
AreaMark(
|
||||
x: .value("时间", p.date),
|
||||
yStart: .value("基线", (valueDomain ?? 0...1).lowerBound),
|
||||
yEnd: .value(line.label ?? bucket.title, p.value)
|
||||
)
|
||||
.foregroundStyle(LinearGradient(
|
||||
colors: [line.color.opacity(0.16), line.color.opacity(0)],
|
||||
startPoint: .top, endPoint: .bottom))
|
||||
.interpolationMethod(.monotone)
|
||||
}
|
||||
}
|
||||
|
||||
// 折线 + 点
|
||||
ForEach(bucket.lines) { line in
|
||||
ForEach(line.points) { p in
|
||||
@@ -119,8 +137,10 @@ struct SeriesChartCard: View {
|
||||
y: .value(line.label ?? bucket.title, p.value)
|
||||
)
|
||||
.foregroundStyle(line.color)
|
||||
.interpolationMethod(.catmullRom)
|
||||
.lineStyle(StrokeStyle(lineWidth: 2))
|
||||
// monotone:平滑但不在数据尖峰处过冲鼓包,比 catmullRom 更贴合真实读数。
|
||||
.interpolationMethod(.monotone)
|
||||
// 圆角端点 + 连接,去掉折线的生硬尖角。
|
||||
.lineStyle(StrokeStyle(lineWidth: 2, lineCap: .round, lineJoin: .round))
|
||||
}
|
||||
.symbol {
|
||||
Circle()
|
||||
|
||||
@@ -179,6 +179,23 @@ struct TrendDetailView: View {
|
||||
.foregroundStyle(line.color.opacity(0.08))
|
||||
}
|
||||
}
|
||||
// 单条线时,线下垫一层渐变面积,增加体量、柔化观感
|
||||
//(多条线如血压不加,避免两片面积互相盖住)。
|
||||
if filteredLines.count == 1, let line = filteredLines.first {
|
||||
ForEach(line.points) { p in
|
||||
// 显式把基线钉在值域下界:用单值 AreaMark 会以隐式基线(0/域外)兜底,
|
||||
// 渐变被拉到可视区外几乎不淡出,看着像一块实色底色一路铺到图表底。
|
||||
AreaMark(
|
||||
x: .value("时间", p.date),
|
||||
yStart: .value("基线", (valueDomain ?? 0...1).lowerBound),
|
||||
yEnd: .value(line.label ?? bucket.title, p.value)
|
||||
)
|
||||
.foregroundStyle(LinearGradient(
|
||||
colors: [line.color.opacity(0.16), line.color.opacity(0)],
|
||||
startPoint: .top, endPoint: .bottom))
|
||||
.interpolationMethod(.monotone)
|
||||
}
|
||||
}
|
||||
ForEach(filteredLines) { line in
|
||||
ForEach(line.points) { p in
|
||||
LineMark(
|
||||
@@ -187,8 +204,10 @@ struct TrendDetailView: View {
|
||||
series: .value("series", line.id)
|
||||
)
|
||||
.foregroundStyle(line.color)
|
||||
.interpolationMethod(.catmullRom)
|
||||
.lineStyle(StrokeStyle(lineWidth: 2))
|
||||
// monotone:平滑但不在尖峰处过冲鼓包,更贴合真实读数。
|
||||
.interpolationMethod(.monotone)
|
||||
// 圆角端点 + 连接,去掉折线的生硬尖角。
|
||||
.lineStyle(StrokeStyle(lineWidth: 2, lineCap: .round, lineJoin: .round))
|
||||
PointMark(
|
||||
x: .value("时间", p.date),
|
||||
y: .value(line.label ?? bucket.title, p.value)
|
||||
@@ -421,6 +440,24 @@ private struct TrendInsightCard: View {
|
||||
.font(.tjScaled( 12, weight: .semibold))
|
||||
.foregroundStyle(Tj.Palette.text2)
|
||||
Spacer()
|
||||
// 手动重新解读:任何时候都能点(解读中除外)。解决偶发不自动触发,
|
||||
// 也允许已生成后再跑一次拿最新解读。
|
||||
if !running {
|
||||
Button { Task { await load(force: true) } } label: {
|
||||
HStack(spacing: 4) {
|
||||
Image(systemName: "arrow.clockwise")
|
||||
.font(.tjScaled( 11, weight: .semibold))
|
||||
Text(text == nil ? String(appLoc: "解读") : String(appLoc: "重新解读"))
|
||||
.font(.tjScaled( 12, weight: .semibold))
|
||||
}
|
||||
.foregroundStyle(Tj.Palette.ink)
|
||||
.padding(.horizontal, 10)
|
||||
.padding(.vertical, 5)
|
||||
.background(Capsule().fill(Tj.Palette.sand2))
|
||||
.contentShape(Capsule())
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
}
|
||||
}
|
||||
if let text {
|
||||
Text(text)
|
||||
@@ -435,15 +472,14 @@ private struct TrendInsightCard: View {
|
||||
.foregroundStyle(Tj.Palette.text3)
|
||||
AIFlowBar()
|
||||
} else if let failedMessage {
|
||||
HStack {
|
||||
Text(failedMessage)
|
||||
.font(.tjScaled( 12))
|
||||
.foregroundStyle(Tj.Palette.text3)
|
||||
Spacer()
|
||||
Button("重试") { Task { await load(force: true) } }
|
||||
.font(.tjScaled( 12, weight: .medium))
|
||||
.foregroundStyle(Tj.Palette.ink)
|
||||
}
|
||||
Text(failedMessage)
|
||||
.font(.tjScaled( 12))
|
||||
.foregroundStyle(Tj.Palette.text3)
|
||||
} else {
|
||||
// 空闲态(偶发没自动触发):给明确引导,点右上即可生成。
|
||||
Text("点右上「解读」生成本地趋势解读")
|
||||
.font(.tjScaled( 12))
|
||||
.foregroundStyle(Tj.Palette.text3)
|
||||
}
|
||||
}
|
||||
.padding(14)
|
||||
|
||||
@@ -54,6 +54,19 @@ struct TrendRow: View {
|
||||
|
||||
private var sparkline: some View {
|
||||
Chart {
|
||||
// 单条线时,线下垫一层渐变面积,迷你图也更有体量、不发生硬。
|
||||
if bucket.lines.count == 1, let line = bucket.lines.first {
|
||||
ForEach(line.points) { p in
|
||||
AreaMark(
|
||||
x: .value("t", p.date),
|
||||
y: .value(line.label ?? bucket.title, p.value)
|
||||
)
|
||||
.foregroundStyle(LinearGradient(
|
||||
colors: [line.color.opacity(0.18), line.color.opacity(0)],
|
||||
startPoint: .top, endPoint: .bottom))
|
||||
.interpolationMethod(.monotone)
|
||||
}
|
||||
}
|
||||
ForEach(bucket.lines) { line in
|
||||
ForEach(line.points) { p in
|
||||
LineMark(
|
||||
@@ -62,8 +75,9 @@ struct TrendRow: View {
|
||||
series: .value("s", line.id)
|
||||
)
|
||||
.foregroundStyle(line.color)
|
||||
.interpolationMethod(.catmullRom)
|
||||
.lineStyle(StrokeStyle(lineWidth: 1.6))
|
||||
// monotone + 圆角端点:迷你曲线更柔,无尖角无过冲。
|
||||
.interpolationMethod(.monotone)
|
||||
.lineStyle(StrokeStyle(lineWidth: 1.6, lineCap: .round, lineJoin: .round))
|
||||
}
|
||||
}
|
||||
// 最新点高亮
|
||||
|
||||
Reference in New Issue
Block a user