Stop the time labels colliding, and let them stand up - #37
Closed
evandhoffman wants to merge 2 commits into
Closed
Conversation
08:52:3008:53:0008:53:30. Three things were wrong at once. The room was measured off the chart rather than the plot, with a flat 50-point allowance standing in for the y-axis — right for one card, and generous for every card whose numbers are long, which are the cards whose plots are narrowest. chartBackground hands over the real plot rect. Not chartOverlay: an overlay would swallow the mouse-down a tile's drag needs. Every stride was costed at the same label width, though a stride of a minute or more shows no seconds and needs a third less room. Measured, at the new smaller label size, that is 20 points against 32. Budgeting the coarse strides at the wide figure left the axis unable to reach for the one a cramped card wanted. And the labels were wider than they needed to be. They get their own size now, smaller than the y-axis labels beside them, and the hour loses its leading zero. Rule 2 now beats rule 1. Slightly tight labels do beat a bare axis, but these were not slightly tight, they were on top of each other. Two labels are still what the walk reaches for; what is gone is the promise. Turning them sideways is how a narrow card has both: on its side a label costs its line height, 10 points against 32, so it fits four times where upright it fits two. Claude-Session: https://claude.ai/code/session_01EqTTtmt4fyNtMxjc2ZVBzj
Contributor
Author
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.
Stacked on #36 — based on
window-totals, so this shows only its own commit.GitHub retargets it to
mainwhen that merges.From a screenshot:
08:52:3008:53:0008:53:30.Three things were wrong at once
allowance stood in for the y-axis. That is right for one card and generous
for every card whose numbers are long — and those are exactly the cards whose
plots are narrowest.
chartBackgroundhands over the real plot rect.Deliberately not
chartOverlay: an overlay sits above the content and wouldswallow the mouse-down a tile's drag needs, which is the trap
ReorderDragalready documents.
more shows no seconds, so "8:52" needs a third less room than "8:52:30".
Measured in SF Rounded at the new size: 20 points against 32. Budgeting the
coarse strides at the wide figure left the axis unable to reach for the one a
cramped card wanted.
smaller than the y-axis labels beside them — there are more of them, they are
longer, and a y-axis label has a whole row to itself. The hour loses its
leading zero; minutes and seconds keep both digits, because those are
positional and "8:5:3" is not a time.
Rule 2 now beats rule 1
The old order was "never fewer than two labels" first, on the grounds that
slightly tight labels beat a bare axis. Right about "slightly tight", wrong
about what the arithmetic produced: four labels 32 points wide with their
centres 40 apart, overlapping outright at the narrowest card. Labels that
collide are unreadable, which is worse than the sparse axis the rule avoided.
Two labels are still what it reaches for — the walk goes finest first, so the
first stride that fits is the densest that fits. What is gone is the promise. A
narrow card showing two minutes has no stride both coarse enough to fit and fine
enough to guarantee two; it now shows one label rather than two on top of each
other.
Turning them sideways is how to have both
Turn the time labels sideways, new in the Charts tab, off by default. On its
side a label costs its line height rather than its width — 10 points against 32
— so the narrowest card fits four times where upright it fits two.
The card from the screenshot (160-point plot, 2 min) keeps its four labels and
gains 12 points of clear gutter between them.
Tests
ChartAxisTestsis rewritten against the new contract, keeping every existingclaim (a tick is an instant, the interval comes from the window's length, ticks
are inset from the edges, the interval is stable as the window slides) and
adding the ones this bug needed:
orientations and forty phases of each window — the ink two neighbouring
labels need against the distance between them.
210 tests pass;
swift build -c releaseandswiftformat --lintclean.Not verified on screen
The arithmetic is tested, the appearance is not. The rotated label frame
(
Theme.Layout.timeLabelRotated, 11 × 40) is the part most likely to want anadjustment by eye.
https://claude.ai/code/session_01EqTTtmt4fyNtMxjc2ZVBzj