Просмотр исходного кода

Update: prediction line will attach if dots are not shown

Jon Fawcett 5 лет назад
Родитель
Сommit
7945a266d4
2 измененных файлов с 10 добавлено и 4 удалено
  1. 9 3
      LoopFollow/Controllers/Graphs.swift
  2. 1 1
      LoopFollow/Controllers/NightScout.swift

+ 9 - 3
LoopFollow/Controllers/Graphs.swift

@@ -489,9 +489,15 @@ extension MainViewController {
             if Float(predictionVal) > topBG - maxBGOffset {
                 topBG = Float(predictionVal) + maxBGOffset
             }
-            // Below can be turned on to prevent out of range on the graph if desired.
-            // It currently just drops them out of view
-            if predictionVal > 400 {
+
+            if i == 0 {
+                if UserDefaultsRepository.showDots.value {
+                    colors.append(NSUIColor.systemPurple.withAlphaComponent(0.0))
+                } else {
+                    colors.append(NSUIColor.systemPurple.withAlphaComponent(1.0))
+                }
+                
+            } else if predictionVal > 400 {
                 predictionVal = 400
                 colors.append(NSUIColor.systemYellow)
             } else if predictionVal < 0 {

+ 1 - 1
LoopFollow/Controllers/NightScout.swift

@@ -490,7 +490,7 @@ extension MainViewController {
                             predictionData.removeAll()
                             var predictionTime = lastLoopTime
                             let toLoad = Int(UserDefaultsRepository.predictionToLoad.value * 12)
-                            var i = 1
+                            var i = 0
                             while i <= toLoad {
                                 if i < prediction.count {
                                     let prediction = ShareGlucoseData(sgv: prediction[i], date: predictionTime, direction: "flat")