Skip to content

feat: add line chart, bar chart and sparkline - #236

Merged
starc007 merged 3 commits into
mainfrom
feat/line-bar-sparkline-charts
Oct 27, 2026
Merged

starc007 merged 3 commits into
mainfrom
feat/line-bar-sparkline-charts

Conversation

@starc007

@starc007 starc007 commented Oct 27, 2026 •

Copy link
Copy Markdown
Owner

What

Three new charts in the charts category, on a shared components/charts/xy/ layer.

  • Line Chart (@beui/line-chart): line and area variants, monotone/linear/step curves.
    • Every sample is a spring keyed by series and category, so new data, hidden series and axis rescales morph lines, fills and dots together. Resizes snap.
    • Lines draw in on first view and fade out at the plot edges.
    • Inspecting shows a crosshair with haloed dots, recedes the line past the crosshair, and rolls a pill along the category axis.
    • The tooltip lives inside the chart and springs beside the highest value. It flips near the right edge, and on narrow plots moves above or below the point.
    • status="loading" shows a pulsing placeholder that hands off to the draw-in.
  • Bar Chart (@beui/bar-chart): grouped or stacked, vertical or horizontal, sort by visible total.
    • Bars animate with transforms only, using a separate rounded cap so corners never stretch.
    • Bars grow in with a stagger, and categories glide to new ranks when sorting changes.
    • The tooltip follows the pointer, like Volume Profile's, with a soft band gliding behind the hovered category.
  • Sparkline (@beui/sparkline): compact trend with an optional change badge (invertDelta for lower-is-better metrics).
    • A labelled image by default, with no tab stop.
    • interactive adds one slider and a value readout.
  • Shared xy/ layer:
    • Data cleanup: first of repeated ids wins, and invalid values become gaps, never zeros.
    • Rounded ticks, curves and animated points.
    • One native-slider inspector, legend toggles, tooltip rows and a hidden data table.

Why

The catalog had specialized charts but no plain line or bar chart, which are the most common requests. Sparkline covers stat cards and tables.

Accessibility

  • Each chart is one tab stop: an invisible native slider over the plot. Arrow keys, Home and End step categories, and the slider announces every visible value.
  • Horizontal bars follow visual order, with Arrow Down moving down the list.
  • Legend entries are pressed-state buttons.
  • A visually hidden table lists every value, and gaps read as No data.
  • While loading, the line chart is marked busy, announces its label, and leaves out the slider and table.
  • Mouse-click focus no longer pins tooltips open after the pointer leaves. Keyboard focus and touch tap-to-inspect still hold.
  • Reduced motion drops the draw-in, springs, stagger and roll, and keeps opacity changes.

Also

  • Registry entries with launchedAt, previews and usage files, About and SEO copy, component dates and changelog lines.
  • AGENTS.md catalog rows for all three charts.
  • Previews use the library Tabs in the docs pill style.

Verification

  • bun run check passes, and bun test passes 190 accessibility tests, including new tests/xy-charts.a11y.test.tsx.
  • Checked in the browser:
    • Desktop and 375px mobile, with no horizontal scroll.
    • Keyboard, simulated touch drags, the loading handoff, and tooltip placement at plot edges and on narrow plots.
  • Not checked visually: reduced motion, which can't be emulated in the browser pane. Those code paths are covered by review and by the tests, which render with reduced motion.

- Line Chart: line and area variants, springs per sample so data, hidden
  series and rescales morph together, edge-faded lines, receding line past
  the crosshair, axis pill, spring-follow tooltip, and a loading status
  with a placeholder that hands off to the draw-in
- Bar Chart: grouped or stacked, vertical or horizontal, sort by total
  with bars gliding to new ranks, transform-only bars with rounded caps
- Sparkline: compact trend with change badge, invertDelta and an optional
  interactive readout
- Shared xy layer: data cleanup, nice ticks, curves, animated points,
  inspection slider, legend, tooltip rows and an accessible data table
…y tabs in previews

- A click no longer pins line, bar and sparkline tooltips open: focus from
  the mouse closes on leave, while keyboard focus and touch taps still hold
- Line and bar chart previews switch views with the library Tabs in the
  docs pill style instead of hand-rolled toggles
- The readout follows the pointer and sizes to its content; keyboard
  inspection anchors it at the end of the category's longest bar
- A soft band glides behind the inspected category instead of dimming
  the others
- Tooltip value rolls keep a short tween inside spring-based tabs
@starc007
starc007 merged commit 632ca8a into main Oct 27, 2026
1 check passed
@starc007
starc007 deleted the feat/line-bar-sparkline-charts branch October 27, 2026 09:38
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