Skip to main content

egui_charts/
prelude.rs

1//! Common types and extension traits for embedding a chart.
2//!
3//! Implement a feed with the same imports used to embed a chart:
4//!
5//! ```
6//! use egui_charts::prelude::*;
7//!
8//! struct Feed;
9//!
10//! impl Datafeed for Feed {
11//!     fn history(&self, _: HistoryRequest, reply: Reply<HistoryPage>) {
12//!         reply.send(Ok(HistoryPage::new(Vec::new(), true)));
13//!     }
14//!
15//!     fn subscribe(&self, _: Subscription) {}
16//! }
17//! ```
18//!
19//! ```
20//! use egui_charts::prelude::*;
21//!
22//! let bars = vec![Bar::new(
23//!     chrono::Utc::now(), 100.0, 102.0, 99.0, 101.0, 10.0,
24//! )];
25//! # #[cfg(feature = "widget")]
26//! let mut chart = ChartBuilder::new().build();
27//! # #[cfg(feature = "widget")]
28//! chart.set_data(SeriesId::MAIN, bars);
29//! ```
30
31pub use crate::data::{
32    Datafeed, FeedError, HistoryPage, HistoryRequest, Reply, Sink, Subscription,
33};
34pub use crate::model::{Bar, BarData, ChartType, Instrument, LineStyle, OrderSide, Timeframe};
35pub use crate::studies::{CustomIndicator, Indicator, IndicatorValue, StudyError};
36
37#[cfg(feature = "widget")]
38pub use crate::config::{ChartConfig, ChartOptions};
39#[cfg(feature = "widget")]
40pub use crate::theme::{Theme, ThemeExt};
41#[cfg(feature = "widget")]
42pub use crate::widget::{Chart, ChartBuilder, SeriesId};
43
44#[cfg(feature = "widget")]
45pub use crate::widget::settings::ChartSettingsState;