Skip to content

Extract a pure chart package - #18

Merged
namest504 merged 4 commits into
mainfrom
refactor/chart-package
Aug 21, 2026
Merged

Extract a pure chart package#18
namest504 merged 4 commits into
mainfrom
refactor/chart-package

Conversation

@namest504

Copy link
Copy Markdown
Owner

Summary

  • Move line-chart and sparkline rendering into a new internal/chart package that computes a plain cell grid (rune + kind) with no tcell dependency
  • Reduce ui.DrawLineChart / ui.Sparkline to thin adapters; call sites unchanged
  • Fix a latent scaling bug while porting: the braille line now scales against the raw series bounds (matching the axis labels) instead of the downsampled array's bounds
  • Port all chart tests to grid-based table tests

No intended visual change except the downsampled-series scaling fix.

pixelRows and renderBraille recomputed lo/hi from the downsampled
array instead of using the true series bounds the axis labels are
drawn from. When cols*2 < len(series), a narrow peak can be smoothed
below the true max by interpolation before sampling, so the line
would report as touching the axis top even though the labeled max is
much higher. Both now take lo, hi as parameters, and Render passes
through the raw-series bounds it already computed for the axis.

Also removes the unused braille2 test helper.
@namest504
namest504 merged commit 01ec850 into main Aug 21, 2026
1 check passed
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