pub struct SyncAxes {
pub sync_x: bool,
pub sync_y: bool,
/* private fields */
}Expand description
Synchronize one or more axes (X and/or Y) across a set of Plot
instances every frame. Mirrors silx SyncAxes from
silx.gui.plot.utils.axis.
Call SyncAxes::sync once per frame, before calling
crate::PlotView::show for each plot. The first plot whose limits
differ from the last-seen state is taken as the source; all other
plots are updated to match.
§Example
ⓘ
let mut sync = SyncAxes::new(); // sync both axes by default
// In the frame loop:
sync.sync(&mut [&mut plot_a, &mut plot_b]);
view.show(ui, &mut plot_a);
view.show(ui, &mut plot_b);Fields§
§sync_x: boolSynchronize the X axis limits. Default true.
sync_y: boolSynchronize the left Y axis limits. Default true.
Implementations§
Source§impl SyncAxes
impl SyncAxes
Sourcepub fn with_sync_x(self, on: bool) -> Self
pub fn with_sync_x(self, on: bool) -> Self
Enable or disable X-axis limit synchronization.
Sourcepub fn with_sync_y(self, on: bool) -> Self
pub fn with_sync_y(self, on: bool) -> Self
Enable or disable Y-axis limit synchronization.
Sourcepub fn reset(&mut self)
pub fn reset(&mut self)
Reset the remembered limits so the next sync call
re-initializes from the first plot. Call this when replacing all plots.
Sourcepub fn sync(&mut self, plots: &mut [&mut Plot])
pub fn sync(&mut self, plots: &mut [&mut Plot])
Synchronize limits across all plots for this frame.
- If this is the first call (or after
reset), limits are copied from the first plot to all others. - Otherwise the first plot whose current limits differ from the previously seen state is used as the source.
- A no-op for empty slices or when both sync flags are
false.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SyncAxes
impl RefUnwindSafe for SyncAxes
impl Send for SyncAxes
impl Sync for SyncAxes
impl Unpin for SyncAxes
impl UnsafeUnpin for SyncAxes
impl UnwindSafe for SyncAxes
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
Mutably borrows from an owned value. Read more
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.