Raw-format rendering fixes: axes, crispness, contrast - #9
Merged
Conversation
Two bugs in the pixel-perfect (kitty/sixels/iterm2) axis path:
- Right/large y-axis labels (e.g. "13,000") were clipped at the canvas edge —
uPlot's default ~50px y-axis width isn't enough at the scaled-up font. Now
auto-size vertical axes to their widest measured label.
- showAxes={false} still drew uPlot's canvas axes and grid. Thread showAxes
through renderToImageData/renderToPNG; when false, hide axes/grid/ticks. Also
default to [x, y] when no axes are defined, since uPlot draws implicit axes
for an empty array.
- Render at 2x cell density (supersample) so charts stay crisp when the terminal upscales the image — at 1x they looked blurry on small/hi-DPI terminals. - Brighten default axis stroke (#aaa) and example axis colors (#555 -> #999) for readable labels on dark terminals. - Address code review: apply the [x, y] default to the visible-axes branch too, so implicit axes get styling + auto-sizing (not uPlot's tiny defaults); add showAxes to the render effect deps. - Examples with index x-data (shaded-area, multi-series, basic-line) now set scales.x.time=false so the x-axis shows plain numbers, not bogus 1970 dates.
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.
Fixes several raw-format (kitty/sixels/iterm2) rendering issues surfaced while capturing example screenshots.
Axes
13,000were clipped at the canvas edge (uPlot's default ~50px width is too small at the scaled-up font).showAxes={false}now hides axes/grid/ticks (was ignored for raw formats). ThreadedshowAxesthroughrenderToImageData/renderToPNG.[x, y]on all branches, since uPlot draws default axes for an empty array — so styling + auto-sizing apply even when the caller defines no axes. AddedshowAxesto the render effect deps.Quality
#aaa) and example colors (#555→#999).scales.x.time=falseso the x-axis shows plain numbers, not bogus 1970 dates.Verified via
renderToPNG. tsc clean; 79 tests pass. Reviewed by an independent agent (found & fixed the implicit-axes hole).