Skip to content

Raw-format rendering fixes: axes, crispness, contrast - #9

Merged
planadecu merged 2 commits into
mainfrom
fix/raw-format-axes
Jul 14, 2026
Merged

Raw-format rendering fixes: axes, crispness, contrast#9
planadecu merged 2 commits into
mainfrom
fix/raw-format-axes

Conversation

@planadecu

@planadecu planadecu commented Jul 14, 2026

Copy link
Copy Markdown
Owner

Fixes several raw-format (kitty/sixels/iterm2) rendering issues surfaced while capturing example screenshots.

Axes

  • Auto-size vertical axes to their widest label — large right-axis labels like 13,000 were 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). Threaded showAxes through renderToImageData/renderToPNG.
  • Implicit-axes fix (from code review): default to [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. Added showAxes to the render effect deps.

Quality

  • 2x pixel density (supersample) so charts stay crisp when the terminal upscales the image — at 1x they looked blurry on small/hi-DPI terminals. Display size unchanged.
  • Readable axis contrast — brighter default stroke (#aaa) and example colors (#555#999).
  • Examples with index x-data (shaded-area, multi-series, basic-line) set scales.x.time=false so 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).

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.
@planadecu planadecu changed the title Fix raw-format axes: auto-size y-axis, honor showAxes Raw-format rendering fixes: axes, crispness, contrast Jul 14, 2026
@planadecu
planadecu merged commit 7f455f4 into main Jul 14, 2026
2 checks passed
@planadecu
planadecu deleted the fix/raw-format-axes branch July 14, 2026 09:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant