fix(ui): dynamic viewBox so trend chart renders 1:1 on wide screens (rant 2026-08-24T14:29:57) - #144
Merged
Merged
Conversation
…rant 2026-08-24T14:29:57)
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 freeto 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.
Summary
Fixes the root cause of the oversized fonts / thick lines on the "点数趋势" (points trend) chart (v0.7.16): the SVG was being uniformly scaled up ~2.4×. The
viewBoxwas fixed at0 0 640 85whilewidth:100%stretched the element to the full container width (1534px on wide screens);height:autothen scaled by the viewBox aspect ratio →canvasScale = 1534/640 = 2.397. Sostroke-width:1.4pxrendered ≈3.4px and 8px axis fonts rendered ≈19px — which is also why the fine-tuning in v0.7.15→v0.7.16 appeared to have "no effect" (the gains were swallowed by the 2.4× scaling).Fix (JS + HTML only)
ui/js/app.js: replaced the fixed viewBox geometry (W=640, H=85, PL=32, PR=8, PT=6, PB=14) with dynamic viewBox geometry —Wis derived from the actual container width so that 1 viewBox unit ≈ 1 physical pixel on wide screens (scale = 1.000, real px).viewBoxattribute, so it stays accurate.Verified: wide screen scale = 1.000 (real px); small screens keep the previous downscale behavior; aspect ratio unchanged. Existing features preserved: gradient area, smooth curve, metric switching, hover tooltip.
Tests
node --check ui/js/app.js— OKcargo test— 146/146 passed (JS-only change, Rust gate green)20260824-11 → 20260824-12Related rant
Host rant
2026-08-24T14:29:57.028007(verbatim):