Skip to content

Add sparkline mode for compact table-cell charts#27

Merged
mortonanalytics merged 1 commit intodevelopfrom
feature/sparkline-mode
Mar 28, 2026
Merged

Add sparkline mode for compact table-cell charts#27
mortonanalytics merged 1 commit intodevelopfrom
feature/sparkline-mode

Conversation

@mortonanalytics
Copy link
Copy Markdown
Owner

Summary

  • Adds myIO(sparkline = TRUE) for compact, axes-free charts at 20px height — ideal for embedding in reactable, DT, and gt table cells
  • Strips legend, axes, reference lines, and all interactions in sparkline mode
  • Only line, bar, and area layer types supported; others error with a clear message

What changed

  • R API: sparkline parameter on myIO(), type validation guard in addIoLayer()
  • JS: applySparklineOverrides() in Chart constructor — sets 1px margins, suppresses legend/axes/interactions, sets data-sparkline attribute
  • CSS: Sparkline-specific rules — hide FAB/buttons/panels, crisp bar rendering, 1.5px line stroke
  • Docs: vignettes/sparklines.Rmd, NEWS.md v1.2.0 entry, updated man/myIO.Rd

Test plan

  • R tests pass: 648/648 (devtools::test())
  • JS tests pass: 176/176 (npx vitest run)
  • 12 R sparkline contract tests (test_sparkline.R)
  • 7 JS sparkline contract tests (sparkline.test.js)
  • Backward compatibility: existing myIO() calls unaffected
  • Manual: render sparkline at 20px height in browser
  • Manual: embed in reactable table cell

🤖 Generated with Claude Code

Adds `sparkline = TRUE` parameter to `myIO()` that renders compact,
axes-free charts at 20px height — suitable for embedding in reactable,
DT, and gt table cells. Strips legend, interactions, and reference lines.
Supports line, bar, and area layer types.

R: sparkline param on myIO(), type validation in addIoLayer()
JS: applySparklineOverrides() in Chart constructor, sparkline CSS
Tests: 12 R tests, 7 JS vitest tests (19 total)
Docs: sparklines.Rmd vignette, NEWS.md v1.2.0 entry

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@mortonanalytics mortonanalytics merged commit 0645eff into develop Mar 28, 2026
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