fix(charts): 将复合图数据曲线统一为平滑实线

This commit is contained in:
2026-11-03 12:54:59 +08:00
parent 7ef92d9c21
commit 8a7303f6b2
4 changed files with 10 additions and 5 deletions
+2 -3
View File
@@ -201,8 +201,7 @@ private struct PanelCurveCanvas: View, Animatable {
guard let first = targetBegin, let last = targetEnd else { return }
let domain = PanelCurveFrame.domain(previousBegin: previousBegin, previousEnd: previousEnd,
begin: first, end: last, progress: Double(progress))
for (seriesIndex, entry) in zip(frame.series, colors).enumerated() {
let (values, tint) = entry
for (values, tint) in zip(frame.series, colors) {
for run in PanelCurveGeometry.runs(dates: frame.dates, values: values, maximumGap: maximumGap, boundaryDates: frame.boundaryDates, intervals: frame.intervals) {
let points = run.map { item in
CGPoint(x: size.width * domain.position(item.date),
@@ -221,7 +220,7 @@ private struct PanelCurveCanvas: View, Animatable {
var area = line
area.addLine(to: CGPoint(x: finish.x, y: size.height)); area.addLine(to: CGPoint(x: start.x, y: size.height)); area.closeSubpath()
context.fill(area, with: .linearGradient(Gradient(colors: [tint.opacity(0.20), tint.opacity(0.01)]), startPoint: .zero, endPoint: CGPoint(x: 0, y: size.height)))
context.stroke(line, with: .color(tint), style: StrokeStyle(lineWidth: 1.5, lineCap: .round, lineJoin: .round, dash: seriesIndex == 1 ? [4, 2] : seriesIndex == 2 ? [1, 2] : []))
context.stroke(line, with: .color(tint), style: StrokeStyle(lineWidth: 1.5, lineCap: .round, lineJoin: .round))
}
}
}