Expand description
Historical bar replay controls, session state and cursor management.
Use ReplayController to drive playback over host-supplied bars and apply its
cutoff to the chart with Chart::set_replay_time.
ReplayControls emits playback and seek actions; the host retains or persists
the session and supplies any additional source history.
§Example
use egui_charts::ui::replay::{ReplayController, ReplayControls};
// Keep the full history in the chart and drive its window with the source cursor.
use egui_charts::{Chart, model::{BarData, BarClock, Timeframe}};
let mut chart = Chart::new(BarData::from_bars(bars.clone()));
chart.set_timeframe(Timeframe::Min1);
// Create replay controller with data
let mut controller = ReplayController::new(bars, ts);
// In your UI loop:
egui::Panel::bottom("replay").show(ui, |ui| {
let controls = ReplayControls::new(&controller.config);
let action = controls.show(ui, &mut controller.state);
controller.handle_action(action);
});
chart.set_replay_time(controller.cutoff(&BarClock::new(Timeframe::Min1)));
// Supply finer history with chart.set_replay_source when it is available.
// One-trade bars from data::aggregate_trades advance it trade by trade.
// Store controller.session() in host storage and restore it after fetching source history.Re-exports§
pub use crate::model::ReplaySession;
Modules§
Structs§
- Compact
Replay Controls - Compact replay controls (minimal UI)
- Replay
Behavior - Behavior configuration for replay
- Replay
Colors - Colors for replay UI elements
- Replay
Config - Complete replay configuration
- Replay
Controller - Replay controller
- Replay
Controls - Replay control bar widget
- Replay
Keyboard Handler - Replay keyboard handler
- Replay
Layout - Layout configuration for replay controls
- Replay
Marker - Replay marker for annotating specific bars
- Replay
Start Picker - Start selection dialog shared by hosts of the replay controller.
- Replay
State - Main replay state
- Replay
Toolbar - Replay toolbar widget
- Replay
Toolbar Config - Replay toolbar configuration
- Replay
Toolbar State - Replay toolbar state
Enums§
- Playback
State - Playback state for the replay
- Replay
Action - Actions that can be performed during replay mode
- Replay
Speed - Predefined speed presets for replay
- Replay
Start Action - A replay start requested by the user.
- Replay
Toolbar Action - Action emitted by the replay toolbar