Skip to main content

gpui_liveplot/
lib.rs

1//! gpui_liveplot is a high-performance plotting library built for GPUI.
2//!
3//! # Overview
4//! - Designed for append-only, high-throughput telemetry and sensor streams.
5//! - Plot-level axes with shared transforms across all series.
6//! - Viewport-aware decimation keeps rendering near `O(width)` for smooth interaction.
7//! - Interactive pan, zoom, box zoom, hover readout, and pin annotations via GPUI.
8//!
9//! # Feature flags
10//! - None at the moment.
11//!
12//! # Quick start
13//! ```rust
14//! use gpui_liveplot::{LineStyle, Plot, Series, SeriesKind, Theme};
15//!
16//! let mut plot = Plot::builder().theme(Theme::dark()).build();
17//! let series = Series::from_iter_y(
18//!     "sensor",
19//!     (0..1000).map(|i| (i as f64 * 0.01).sin()),
20//!     SeriesKind::Line(LineStyle::default()),
21//! );
22//! plot.add_series(&series);
23//! plot.refresh_viewport(0.05, 1e-6);
24//! ```
25//!
26//! # GPUI integration
27//! Use [`gpui_backend::GpuiPlotView`] to render and interact with a plot inside a GPUI
28//! window. See the `examples/` directory for complete runnable examples.
29
30#![forbid(unsafe_code)]
31
32pub mod axis;
33pub mod datasource;
34pub mod geom;
35pub mod interaction;
36pub mod plot;
37pub mod render;
38pub mod series;
39pub mod style;
40pub mod transform;
41pub mod view;
42
43pub mod gpui_backend;
44
45pub use axis::{AxisConfig, AxisConfigBuilder, AxisFormatter, TickConfig};
46pub use datasource::AppendError;
47pub use geom::Point;
48pub use interaction::Pin;
49pub use plot::{Plot, PlotBuilder};
50pub use render::{Color, LineStyle, MarkerShape, MarkerStyle};
51pub use series::{Series, SeriesId, SeriesKind};
52pub use style::Theme;
53pub use view::{Range, View, Viewport};
54
55pub use gpui_backend::{
56    GpuiPlotView, LinkMemberId, PlotHandle, PlotLinkGroup, PlotLinkOptions, PlotViewConfig,
57};