1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
//! Real-time charts for [Weird Brains](https://weirdbrains.com) apps: a renderer-independent
//! core with optional [GPUI](https://crates.io/crates/gpui) and
//! [Ratatui](https://crates.io/crates/ratatui) backends.
//!
//! The core has no GUI dependencies. It holds time-ordered series in ring buffers
//! ([`Series`]), arranges them in panes over one time axis ([`Chart`]), tracks the visible
//! window with pan, zoom and live following ([`Viewport`]), and lays the visible part out as
//! backend-neutral primitives ([`Scene`]) with "nice" value ticks and calendar-aware time
//! ticks. [`FrameThrottle`] turns a stream of live updates into redraws at the frame rate.
//!
//! ```
//! use weirdnet_chart::{Candle, Chart, Metrics, Pane, Size, YRange, time::MINUTE};
//!
//! let mut chart = Chart::new();
//! let candles = chart.add_candles(Chart::MAIN, "BTC-USD").unwrap();
//! let volume = chart.add_pane(Pane { weight: 1.0, y_range: YRange::AutoFromZero, title: None });
//! chart.add_volume(volume, candles).unwrap();
//! chart.show_latest(60 * MINUTE);
//!
//! // History, then live trades folded into one-minute candles.
//! chart.push_candle(candles, Candle::new(0, 100.0, 101.0, 99.5, 100.5, 12.0)).unwrap();
//! chart.apply_trade(candles, 61_000, 100.7, 0.5, MINUTE).unwrap();
//!
//! let scene = chart.layout(Size::new(800.0, 400.0), &Metrics::PIXELS);
//! assert_eq!(scene.panes.len(), 2);
//! ```
//!
//! # Features
//!
//! - `ratatui`: [`ratatui::ChartWidget`], a Ratatui widget drawn with braille dots.
//! - `gpui`: [`gpui::ChartView`], a GPUI view drawn with paths and quads, with pan and zoom.
pub use ;
pub use Rgba;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use Viewport;