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//! - `gpui_component_theme`: when enabled, [`gpui_backend::PlotView`] will use the
11//! current `gpui-component` global theme if it exists.
12//!
13//! # Quick start
14//! ```rust
15//! use gpui_liveplot::{LineStyle, Plot, Series, SeriesKind, Theme};
16//!
17//! let mut plot = Plot::builder().theme(Theme::dark()).build();
18//! let series = Series::from_iter_y(
19//! "sensor",
20//! (0..1000).map(|i| (i as f64 * 0.01).sin()),
21//! SeriesKind::Line(LineStyle::default()),
22//! );
23//! plot.add_series(&series);
24//! plot.refresh_viewport(0.05, 1e-6);
25//! ```
26//!
27//! # GPUI integration
28//! Use [`gpui_backend::PlotView`] to render and interact with a plot inside a GPUI
29//! window. See the `examples/` directory for complete runnable examples.
30
31#![forbid(unsafe_code)]
32
33pub mod axis;
34pub mod datasource;
35pub mod geom;
36pub mod interaction;
37pub mod plot;
38pub mod render;
39pub mod series;
40pub mod style;
41pub mod transform;
42pub mod view;
43
44pub mod gpui_backend;
45
46pub use gpui::{Hsla, Rgba};
47
48pub use axis::{AxisConfig, AxisConfigBuilder, AxisFormatter, TickConfig};
49pub use datasource::AppendError;
50pub use geom::Point;
51pub use interaction::Pin;
52pub use plot::{Plot, PlotBuilder};
53pub use render::{LineStyle, MarkerShape, MarkerStyle};
54pub use series::{Series, SeriesId, SeriesKind};
55pub use style::Theme;
56pub use view::{Range, View, Viewport};
57
58pub use gpui_backend::{
59 LinkMemberId, PlotHandle, PlotLinkGroup, PlotLinkOptions, PlotView, PlotViewConfig,
60};