@@ -209,6 +209,7 @@ class StatusViewController: UIViewController, NCWidgetProviding {
209209 let unit = glucose [ 0 ] . unit
210210 let glucoseFormatter = NumberFormatter . glucoseFormatter ( for: unit)
211211
212+ charts. glucoseUnit = unit
212213 charts. glucosePoints = glucose. map {
213214 ChartPoint (
214215 x: ChartAxisValueDate ( date: $0. startDate, formatter: dateFormatter) ,
@@ -225,20 +226,20 @@ class StatusViewController: UIViewController, NCWidgetProviding {
225226 charts. predictedGlucosePoints = predictedGlucose. map {
226227 ChartPoint (
227228 x: ChartAxisValueDate ( date: $0. startDate, formatter: dateFormatter) ,
228- y: ChartAxisValueDoubleUnit ( $0. value , unitString: unit. unitString, formatter: glucoseFormatter)
229+ y: ChartAxisValueDoubleUnit ( $0. quantity . doubleValue ( for : unit ) , unitString: unit. unitString, formatter: glucoseFormatter)
229230 )
230231 }
231232
232233 if let eventualGlucose = predictedGlucose. last {
233234 let formatter = NumberFormatter . glucoseFormatter ( for: eventualGlucose. unit)
234235
235- if let eventualGlucoseNumberString = formatter. string ( from: NSNumber ( value: eventualGlucose. value ) ) {
236+ if let eventualGlucoseNumberString = formatter. string ( from: NSNumber ( value: eventualGlucose. quantity . doubleValue ( for : unit ) ) ) {
236237 subtitleLabel. text = String (
237238 format: NSLocalizedString (
238239 " Eventually %1$@ %2$@ " ,
239240 comment: " The subtitle format describing eventual glucose. (1: localized glucose value description) (2: localized glucose units description) " ) ,
240241 eventualGlucoseNumberString,
241- eventualGlucose . unit. glucoseUnitDisplayString
242+ unit. glucoseUnitDisplayString
242243 )
243244 subtitleLabel. isHidden = false
244245 }
0 commit comments