gpui-liveplot
gpui-liveplot is a high-performance plotting library for GPUI, designed for
append-only telemetry and sensor streams.
It focuses on GPUI-native layout, rendering, and interaction for real-time charts.
Features
- Append-only data model optimized for streaming workloads.
- Shared plot-level axes across all series.
- Viewport-aware decimation with multi-level summaries for stable interaction at scale.
- Interactive pan, zoom, box-zoom, hover readout, and point pinning.
- Linked multi-plot interactions (
x/yview sync, cursor sync, brush sync, reset sync). - Configurable styles and dark/light themes.
Installation
Add this crate to your project:
[]
= "0.1"
In Rust code, import it as gpui_liveplot:
use ;
Quick Start
use ;
use ;
new.run;
Streaming Data
Series is append-only. You can keep a shared handle and push new points over time.
- Implicit X mode:
Series::line/Series::scatter+push_y/extend_y - Explicit X/Y mode:
Series::from_iter_points+push_point/extend_points
Plot::add_series stores a shared series handle, so appends from other handles
become visible immediately.
View Modes
View::AutoAll(default)View::ManualView::FollowLastNView::FollowLastNXY
Interaction (GPUI Backend)
- Left drag in plot area: pan
- Right drag in plot area: box zoom
- Mouse wheel in plot area: zoom both axes around cursor
- Mouse wheel on axis area: zoom single axis
- Left click: toggle nearest-point pin
- Double click in plot area: reset view
Multi-Plot Linking
Use PlotLinkGroup and PlotLinkOptions to link multiple GpuiPlotView instances.
See examples/advanced.rs for a complete linked-streaming demo.
Examples
- Basic usage:
cargo run --example basic - Streaming + linked plots:
cargo run --example advanced
Performance Notes
- Line rendering is kept close to
O(plot_width)through decimation. - Multi-level summaries speed up zoomed-out views.
- Render caching is keyed by viewport, size, and data generation.
Limitations
- Append-only workflows are the primary optimization target.
- Only linear axes are currently supported.
Development
RUSTC_WRAPPER=
RUSTC_WRAPPER=
License
MIT. See LICENSE.