Repository navigation
Draw the Glucose Graph complication in the widget at its slot's size - #2
Merged
jeremybarnum merged 1 commit intoNov 1, 2026
Conversation
The watch app rendered the chart as a 171x54 image (the ClockKit graphic rectangular size) and the widget showed it aspect-fit under its header line, so on 45 mm and larger watches the graph filled only about three quarters of the slot's width. The app now publishes the graph's data in the snapshot as plain numbers in the display unit (target ranges, the active override, readings, prediction, axis bounds and labels), and the widget draws it with a Canvas at the space the slot leaves, positioned for each timeline entry's date. The drawing follows ComplicationChartManager, which the ClockKit complications still use. The PNG in the app group is no longer written.
ps2
marked this pull request as ready for review
November 1, 2026 19:26
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Glucose Graph complication only fills about three quarters of its slot's width on a 45 mm watch. The watch app renders the chart as a 171×54 image, the old ClockKit graphic rectangular size, and the widget shows it aspect-fit under the header line. The space under the header is shorter than 54 pt, so the image is scaled down and leaves a gap on the right.
This moves the drawing into the widget:
ComplicationSnapshotinstead of a PNG. That's plain numbers in the display unit: target ranges, the active override, readings, the prediction, and the axis bounds and labels. It's a few KB of JSON, and the extension still links nothing of Loop's.Canvasin whatever space the slot leaves under the header, so it fills the slot on every watch size.ComplicationChartManager: 4 h centered on now, the same bands, dots, dashed prediction and labels.ComplicationChartManager. The PNG in the app group is no longer written.Testing:
ComplicationSnapshotTestspass, with a new round trip of a snapshot carrying a graph.