|
|
@@ -48,7 +48,7 @@ struct MainChartView2: View {
|
|
|
static let bolusScale: CGFloat = 2.5
|
|
|
static let carbsSize: CGFloat = 5
|
|
|
static let carbsScale: CGFloat = 0.3
|
|
|
- static let fpuSize: CGFloat = 20
|
|
|
+ static let fpuSize: CGFloat = 5
|
|
|
}
|
|
|
|
|
|
@Binding var glucose: [BloodGlucose]
|
|
|
@@ -168,19 +168,18 @@ extension MainChartView2 {
|
|
|
unit: .second
|
|
|
)
|
|
|
).foregroundStyle(.clear)
|
|
|
- /* ForEach(ChartCarbs, id: \.self) { carb in
|
|
|
- let carbAmount = carb.amount
|
|
|
- PointMark(
|
|
|
- x: .value("Time", carb.timestamp, unit: .second),
|
|
|
- y: .value("Value", carb.nearestGlucose.sgv ?? 120)
|
|
|
- )
|
|
|
- .symbolSize((Config.carbsSize + CGFloat(carbAmount) * Config.carbsScale) * 10)
|
|
|
- .foregroundStyle(Color.orange)
|
|
|
- .annotation(position: .top) {
|
|
|
- Text(bolusFormatter.string(from: carbAmount as NSNumber)!).font(.caption2)
|
|
|
- }
|
|
|
- }
|
|
|
- */
|
|
|
+ ForEach(ChartCarbs, id: \.self) { carb in
|
|
|
+ let carbAmount = carb.amount
|
|
|
+ PointMark(
|
|
|
+ x: .value("Time", carb.timestamp, unit: .second),
|
|
|
+ y: .value("Value", carb.nearestGlucose.sgv ?? 120)
|
|
|
+ )
|
|
|
+ .symbolSize((Config.carbsSize + CGFloat(carbAmount) * Config.carbsScale) * 10)
|
|
|
+ .foregroundStyle(Color.orange)
|
|
|
+ .annotation(position: .top) {
|
|
|
+ Text(bolusFormatter.string(from: carbAmount as NSNumber)!).font(.caption2)
|
|
|
+ }
|
|
|
+ }
|
|
|
ForEach(ChartFpus, id: \.self) { fpu in
|
|
|
let fpuAmount = fpu.amount
|
|
|
PointMark(
|
|
|
@@ -480,7 +479,7 @@ extension MainChartView2 {
|
|
|
let fpus = carbs.filter { $0.isFPU ?? false }
|
|
|
fpus.forEach { fpu in
|
|
|
let bg = timeToNearestGlucose(time: fpu.createdAt.timeIntervalSince1970)
|
|
|
- calculatedFpus.append(Carb(amount: fpu.carbs, timestamp: fpu.createdAt, nearestGlucose: bg))
|
|
|
+ calculatedFpus.append(Carb(amount: fpu.carbs, timestamp: fpu.actualDate ?? Date(), nearestGlucose: bg))
|
|
|
}
|
|
|
ChartFpus = calculatedFpus
|
|
|
}
|