fix: results graph clips the wpm peak (#22)#27
Open
hindriix wants to merge 1 commit into
Open
Conversation
The wpm axis upper bound was `highest_wpm.round()`. When the peak has a fraction below 0.5 (e.g. 94.4), round() drops the bound to 94 and the line is clipped at the top — and the same happens to any interior peak, which is why it sometimes clips below the max value too (as noted in the issue's comment). Bound the axis with `ceil()` instead (via a small `results_y_max` helper, with a minimum of 1 so the axis never collapses) so the whole line always fits. Covered by a unit test.
hindriix
force-pushed
the
upstream-pr/graph-y-axis-fix
branch
from
July 25, 2026 06:07
407334a to
d7576c2
Compare
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.
What
Fixes the results graph clipping the top of the wpm line (#22).
The bug
The wpm axis upper bound is
highest_wpm.round(). When the peak has a fractional part below.5— e.g.94.4—round()drops the bound to94, so the peak sits above the axis and gets clipped. The same thing happens to any interior peak, which is exactly why the issue's comment notes it "sometimes happens lower than the max value," not just at the very top.The log line attached to #22 (
...,9.47,94,...) is consistent with this: a sub-.5peak rounding down.The fix
Bound the axis with
ceil()instead ofround()(minimum1so the axis never collapses), via a smallresults_y_maxhelper so it's unit-testable. The whole line now always fits under the axis.Verification
cargo test/clippy/fmt --checkclean; added a unit test asserting the bound is never below the peak (and handles the zero case).