pub struct ChartLayout {
pub mode: ChartLayoutMode,
pub sync: ChartSyncOptions,
/* private fields */
}Expand description
Container state for up to sixteen host-owned charts. Supply charts in stable slot order.
Each chart keeps its own feed, settings, scales, studies and drawings. An unnamed group
synchronizes with other unnamed charts; named groups are isolated. Save this state and the
charts through host storage as needed. Synchronization includes supplied slots hidden by a
grid preset. The container does not acquire data or persist it. Charts that keep their
drawings in the same storage (Chart::set_storage) read the drawings of their symbol again
after another of them wrote them, in any group.
use egui_charts::widget::{Chart, ChartLayout, ChartLayoutMode};
let mut a = Chart::new(egui_charts::model::BarData::new());
let mut b = Chart::new(egui_charts::model::BarData::new());
let mut layout = ChartLayout::default();
layout.mode = ChartLayoutMode::TwoHorizontal;
layout.show(ui, &mut [&mut a, &mut b]);Fields§
§mode: ChartLayoutModeThe selected grid or tab preset.
sync: ChartSyncOptionsSynchronization controls, applied within each group.
Implementations§
Source§impl ChartLayout
impl ChartLayout
Sourcepub fn active(&self) -> usize
pub fn active(&self) -> usize
Active chart slot, clamped to supplied charts by Self::show.
Sourcepub fn set_active(&mut self, index: usize)
pub fn set_active(&mut self, index: usize)
Selects a chart slot and focuses its canvas when shown; out-of-range indices are ignored.
Sourcepub fn set_sync_group(&mut self, index: usize, group: Option<String>)
pub fn set_sync_group(&mut self, index: usize, group: Option<String>)
Assigns a named synchronization group; None restores the unnamed group.
Sourcepub fn sync_group(&self, index: usize) -> Option<&str>
pub fn sync_group(&self, index: usize) -> Option<&str>
The group assigned to a slot, or None for the unnamed group or an invalid slot.
Sourcepub fn set_detached(&mut self, index: usize, detached: bool)
pub fn set_detached(&mut self, index: usize, detached: bool)
Detaches a chart into an immediate viewport. Backends without native multi-window support embed the viewport. Closing it returns the chart to its grid or tab.
Sourcepub fn is_detached(&self, index: usize) -> bool
pub fn is_detached(&self, index: usize) -> bool
Whether a chart is detached.
Sourcepub fn apply_date_range(
&self,
charts: &mut [&mut Chart],
range: VisibleTimeRange,
)
pub fn apply_date_range( &self, charts: &mut [&mut Chart], range: VisibleTimeRange, )
Fits an explicit date selection to the active chart, or its synchronization group
when sync_date_range is enabled. Call after the charts have rendered at their sizes.
Sourcepub fn show(&mut self, ui: &mut Ui, charts: &mut [&mut Chart]) -> Response
pub fn show(&mut self, ui: &mut Ui, charts: &mut [&mut Chart]) -> Response
Shows the preset and synchronizes its charts. Click or scroll a panel to activate it. Its corner menu offers detachment and named groups. The active border is painted inside the chart; stacked charts have a two-point gap and side-by-side charts meet at their edge. Extra charts remain owned by the host and are not painted by a grid preset.
Sourcepub fn visible_chart_rects(
&self,
rect: Rect,
count: usize,
) -> Vec<(usize, Rect)>
pub fn visible_chart_rects( &self, rect: Rect, count: usize, ) -> Vec<(usize, Rect)>
The slot and rectangle of each visible chart inside rect, for an image export.
Uses the on-screen arrangement, omitting detached and hidden slots and tab controls.
count is the number of charts the host owns, including the active one.
Source§impl ChartLayout
impl ChartLayout
Sourcepub fn set_replay_time(
&self,
charts: &mut [&mut Chart],
source: usize,
time: Option<DateTime<Utc>>,
)
pub fn set_replay_time( &self, charts: &mut [&mut Chart], source: usize, time: Option<DateTime<Utc>>, )
Sets one replay cutoff on the source slot’s synchronization group, including hidden
slots. Other groups keep their own sessions. Call for every cursor move and with None
to exit; each chart windows its own host-supplied history at its own interval.
Trait Implementations§
Source§impl Clone for ChartLayout
impl Clone for ChartLayout
Source§fn clone(&self) -> ChartLayout
fn clone(&self) -> ChartLayout
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Default for ChartLayout
impl Default for ChartLayout
Source§fn default() -> ChartLayout
fn default() -> ChartLayout
Auto Trait Implementations§
impl Freeze for ChartLayout
impl RefUnwindSafe for ChartLayout
impl Send for ChartLayout
impl Sync for ChartLayout
impl Unpin for ChartLayout
impl UnsafeUnpin for ChartLayout
impl UnwindSafe for ChartLayout
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more