@@ -343,6 +343,7 @@ struct TrendsAGPChart: View {
343343 let unit : GlucoseUnitStyle
344344 let targetRange : ClosedRange < Double > ?
345345 var height : CGFloat = 180
346+ @ Environment ( \. dynamicTypeSize ) private var typeSize
346347
347348 private func v ( _ mgdl : Double ) -> Double {
348349 min ( max ( unit . value ( mgdl ) , unit . agpDomain . lowerBound ) , unit . agpDomain . upperBound )
@@ -414,7 +415,7 @@ struct TrendsAGPChart: View {
414415 . chartXScale ( domain : 0 ... 1440 )
415416 . chartYScale ( domain : unit . agpDomain )
416417 . chartXAxis {
417- AxisMarks ( values : Self . hourTicks ) { value in
418+ AxisMarks ( values : typeSize . isAccessibilitySize ? [ 0 , 720 , 1440 ] : Self . hourTicks ) { value in
418419 AxisGridLine ( ) . foregroundStyle ( P . grid )
419420 AxisValueLabel {
420421 if let minute = value . as ( Int . self ) { Text ( Self . label ( minute : minute ) ) }
@@ -424,7 +425,8 @@ struct TrendsAGPChart: View {
424425 }
425426 }
426427 . chartYAxis {
427- AxisMarks ( position : . leading , values : unit . agpTicks ) { _ in
428+ AxisMarks ( position : . leading , values : typeSize . isAccessibilitySize
429+ ? [ unit . agpTicks [ 0 ] , unit . agpTicks [ 2 ] , unit . agpTicks [ 4 ] ] : unit . agpTicks ) { _ in
428430 AxisGridLine ( ) . foregroundStyle ( P . grid )
429431 AxisValueLabel ( ) . font ( LoopDesign . Typeface . caption ) . foregroundStyle ( P . inkMuted )
430432 }
@@ -660,6 +662,7 @@ struct InsulinDailyTotalsView: View {
660662 let average : Double
661663 var height : CGFloat = 170
662664 @ Environment ( \. colorScheme ) private var scheme
665+ @ Environment ( \. dynamicTypeSize ) private var typeSize
663666
664667 private var yMax : Double {
665668 let top = max ( totals . map ( \. total ) . max ( ) ?? 0 , average )
@@ -726,7 +729,8 @@ struct InsulinDailyTotalsView: View {
726729 . chartYScale ( domain : 0 ... yMax )
727730 . chartXAxis {
728731 AxisMarks ( values : axisDates ) { value in
729- AxisValueLabel ( centered : true ) {
732+ AxisValueLabel ( centered : ! typeSize . isAccessibilitySize ,
733+ anchor : typeSize . isAccessibilitySize ? ( value . index == 0 ? . topLeading : . topTrailing ) : nil ) {
730734 if let date = value . as ( Date . self ) {
731735 Text ( axisLabel ( date ) )
732736 . multilineTextAlignment ( . center )
@@ -737,9 +741,16 @@ struct InsulinDailyTotalsView: View {
737741 }
738742 }
739743 . chartYAxis {
740- AxisMarks ( position : . leading ) { _ in
741- AxisGridLine ( ) . foregroundStyle ( P . grid )
742- AxisValueLabel ( ) . font ( LoopDesign . Typeface . caption ) . foregroundStyle ( P . inkMuted )
744+ if typeSize . isAccessibilitySize {
745+ AxisMarks ( position : . leading , values : [ 0 , yMax / 2 , yMax ] ) { _ in
746+ AxisGridLine ( ) . foregroundStyle ( P . grid )
747+ AxisValueLabel ( ) . font ( LoopDesign . Typeface . caption ) . foregroundStyle ( P . inkMuted )
748+ }
749+ } else {
750+ AxisMarks ( position : . leading ) { _ in
751+ AxisGridLine ( ) . foregroundStyle ( P . grid )
752+ AxisValueLabel ( ) . font ( LoopDesign . Typeface . caption ) . foregroundStyle ( P . inkMuted )
753+ }
743754 }
744755 }
745756 . accessibilityElement ( children : . ignore )
@@ -750,6 +761,10 @@ struct InsulinDailyTotalsView: View {
750761 }
751762
752763 private var axisDates : [ Date ] {
764+ // Full dates at the largest text sizes need the width between the two ends of the chart.
765+ if typeSize . isAccessibilitySize , let first = totals . first ? . day , let last = totals . last ? . day {
766+ return first == last ? [ first ] : [ first , last ]
767+ }
753768 if weekly {
754769 let stride = max ( 1 , Int ( ceil ( Double ( totals . count ) / 6 ) ) )
755770 return totals . enumerated ( ) . compactMap { index , total in index % stride == 0 ? total . day : nil }
0 commit comments