Skip to main content

Module replay

Module replay 

Source
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§

floating
Floating Replay Control
status
Replay progress and status display.

Structs§

CompactReplayControls
Compact replay controls (minimal UI)
ReplayBehavior
Behavior configuration for replay
ReplayColors
Colors for replay UI elements
ReplayConfig
Complete replay configuration
ReplayController
Replay controller
ReplayControls
Replay control bar widget
ReplayKeyboardHandler
Replay keyboard handler
ReplayLayout
Layout configuration for replay controls
ReplayMarker
Replay marker for annotating specific bars
ReplayStartPicker
Start selection dialog shared by hosts of the replay controller.
ReplayState
Main replay state
ReplayToolbar
Replay toolbar widget
ReplayToolbarConfig
Replay toolbar configuration
ReplayToolbarState
Replay toolbar state

Enums§

PlaybackState
Playback state for the replay
ReplayAction
Actions that can be performed during replay mode
ReplaySpeed
Predefined speed presets for replay
ReplayStartAction
A replay start requested by the user.
ReplayToolbarAction
Action emitted by the replay toolbar