Skip to content

Add AltairWidget for flicker-free Altair charts#130

Merged
koaning merged 3 commits intomainfrom
koaning/smooth-altair-widget
Feb 19, 2026
Merged

Add AltairWidget for flicker-free Altair charts#130
koaning merged 3 commits intomainfrom
koaning/smooth-altair-widget

Conversation

@koaning
Copy link
Copy Markdown
Owner

@koaning koaning commented Feb 17, 2026

Summary

Adds AltairWidget, a smooth Altair chart widget that uses Vega's persistent View API to update chart data without re-rendering the DOM. When data changes, the widget updates in-place via changesets; when chart structure changes, it re-embeds. This preserves interactive state like zoom, pan, and selections across updates.

Implementation

  • Python class accepts Altair chart objects or raw Vega-Lite specs
  • JavaScript loads vega-embed from CDN (~5KB, vs 1.5MB bundled)
  • Spec structure comparison determines update strategy (data-only vs full re-embed)
  • Includes marimo demo with phase/amplitude sliders and full interactivity
  • 9 comprehensive unit tests, API docs, and gallery entries

🤖 Generated with Claude Code

Vincent D. Warmerdam and others added 3 commits February 17, 2026 16:19
Implements a smooth Altair chart widget that uses Vega's persistent View API to patch data in-place without re-parsing specs. This preserves interactive state (zoom, pan, selections) across data updates.

- Python widget class accepts Altair charts or raw Vega-Lite specs
- JavaScript uses CDN-loaded vega-embed for minimal bundle size
- Spec structure comparison: full re-embed on structure change, data-only changeset updates otherwise
- Includes marimo demo with interactive sliders controlling chart data
- Comprehensive unit tests and API documentation

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@koaning koaning merged commit 674edf9 into main Feb 19, 2026
2 checks 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