Struct egui::widgets::plot::PlotUi

source ·
pub struct PlotUi { /* private fields */ }
Expand description

Provides methods to interact with a plot while building it. It is the single argument of the closure provided to Plot::show. See Plot for an example of how to use it.

Implementations§

source§

impl PlotUi

source

pub fn ctx(&self) -> &Context

source

pub fn plot_bounds(&self) -> PlotBounds

The plot bounds as they were in the last frame. If called on the first frame and the bounds were not further specified in the plot builder, this will return bounds centered on the origin. The bounds do not change until the plot is drawn.

source

pub fn set_plot_bounds(&mut self, plot_bounds: PlotBounds)

Set the plot bounds. Can be useful for implementing alternative plot navigation methods.

source

pub fn translate_bounds(&mut self, delta_pos: Vec2)

Move the plot bounds. Can be useful for implementing alternative plot navigation methods.

source

pub fn plot_hovered(&self) -> bool

Returns true if the plot area is currently hovered.

source

pub fn plot_clicked(&self) -> bool

Returns true if the plot was clicked by the primary button.

source

pub fn plot_secondary_clicked(&self) -> bool

Returns true if the plot was clicked by the secondary button.

source

pub fn pointer_coordinate(&self) -> Option<PlotPoint>

The pointer position in plot coordinates. Independent of whether the pointer is in the plot area.

source

pub fn pointer_coordinate_drag_delta(&self) -> Vec2

The pointer drag delta in plot coordinates.

source

pub fn screen_from_plot(&self, position: PlotPoint) -> Pos2

Transform the plot coordinates to screen coordinates.

source

pub fn plot_from_screen(&self, position: Pos2) -> PlotPoint

Transform the screen coordinates to plot coordinates.

source

pub fn line(&mut self, line: Line)

Add a data line.

source

pub fn polygon(&mut self, polygon: Polygon)

Add a polygon. The polygon has to be convex.

source

pub fn text(&mut self, text: Text)

Add a text.

source

pub fn points(&mut self, points: Points)

Add data points.

source

pub fn arrows(&mut self, arrows: Arrows)

Add arrows.

source

pub fn image(&mut self, image: PlotImage)

Add an image.

source

pub fn hline(&mut self, hline: HLine)

Add a horizontal line. Can be useful e.g. to show min/max bounds or similar. Always fills the full width of the plot.

source

pub fn vline(&mut self, vline: VLine)

Add a vertical line. Can be useful e.g. to show min/max bounds or similar. Always fills the full height of the plot.

source

pub fn box_plot(&mut self, box_plot: BoxPlot)

Add a box plot diagram.

source

pub fn bar_chart(&mut self, chart: BarChart)

Add a bar chart.

Auto Trait Implementations§

§

impl !RefUnwindSafe for PlotUi

§

impl !Send for PlotUi

§

impl !Sync for PlotUi

§

impl Unpin for PlotUi

§

impl !UnwindSafe for PlotUi

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

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

const: unstable · 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, U> TryFrom<U> for Twhere
U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more