Skip to main content

PlotView

Struct PlotView 

Source
pub struct PlotView<'a> { /* private fields */ }
Expand description

Stateless view that renders a Plot into an egui Ui.

Implementations§

Source§

impl<'a> PlotView<'a>

Source

pub fn new() -> Self

Create a new plot view.

Source

pub fn with_context_menu(self, ext: &'a mut dyn FnMut(&mut Ui)) -> Self

Append custom entries to the plot’s built-in right-click context menu, after the Zoom Back / Reset Zoom items. See Self::menu_ext for why this hook (and not a second Response::context_menu) is the way to add custom menu entries.

Source

pub fn show(self, ui: &mut Ui, plot: &mut Plot) -> PlotResponse

Render the plot with the default zoom interaction mode, filling the available space. Returns the egui response and the display transform used this frame.

Source

pub fn zoom_back(&self, plot: &mut Plot) -> bool

Restore the previously stored view from the limits history, mirroring silx ZoomBackAction (getLimitsHistory().pop()). Returns true if a stored view was restored, false if the history was empty. The toolbar zoom-back button (a later wave) calls through this.

Source

pub fn show_with_interaction( self, ui: &mut Ui, plot: &mut Plot, interaction_mode: PlotInteractionMode, ) -> PlotResponse

Render the plot with an explicit primary-pointer interaction mode.

Source

pub fn show_with_draw( self, ui: &mut Ui, plot: &mut Plot, draw: &mut DrawState, style: SelectionStyle, ) -> DrawResponse

Render the plot in a draw/select mode driven by draw, painting the in-progress shape as a rubber-band overlay and returning any DrawEvent produced this frame.

The plot is shown in PlotInteractionMode::Select so a primary drag feeds the draw state machine instead of box-zooming (secondary drag still pans, wheel still zooms). Press / move / release on the data area are fed to draw (silx Select* onPress / onMove / onRelease); the resulting preview/finished shape is drawn with style (silx setSelectionArea, PlotInteraction.py:98-141).

Wiring a Finished event to ROI / mask creation is left to the caller (silx high-level widgets / mask tools).

Trait Implementations§

Source§

impl<'a> Default for PlotView<'a>

Source§

fn default() -> PlotView<'a>

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for PlotView<'a>

§

impl<'a> !Send for PlotView<'a>

§

impl<'a> !Sync for PlotView<'a>

§

impl<'a> !UnwindSafe for PlotView<'a>

§

impl<'a> Freeze for PlotView<'a>

§

impl<'a> Unpin for PlotView<'a>

§

impl<'a> UnsafeUnpin for PlotView<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Downcast for T
where T: Any,

Source§

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>

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)

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)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(value: T, _simd: S) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>