Skip to main content

Plot

Struct Plot 

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

A plot widget.

Implementations§

Source§

impl<'a> Plot<'a>

Source

pub fn new(id: impl Into<String>, series: &'a [Series]) -> Self

A plot named id (in the collector and egui’s memory) showing series.

Source

pub fn decimation(self, threshold: Option<usize>) -> Self

Decimates the lines, stepped lines and bands with more than threshold points in view: each pixel column draws at most four of its points (the first, the lowest, the highest and the last), which cover the same pixels as all of them. None draws every point. Default: DECIMATION_THRESHOLD.

A series sorted by x (a time series) is read in the x range in view only, found by binary search: a pass costs the points in view, whatever the series’ length. A series that is not sorted is drawn whole, as egui_plot draws it. The point under the pointer (PlotOutput::hovered) and the values at the pointer are read in the full series, never in the points drawn.

Source

pub fn label(self, label: impl Into<String>) -> Self

Its accessible name (default: “Chart”).

Source

pub fn height(self, height: f32) -> Self

Its height (default: what is available, or egui_plot’s aspect).

Source

pub fn time_cursor(self, time: Option<f64>) -> Self

A vertical line at time (an x value), the time a timeline shows; None, none. The application passes it every pass.

Source

pub fn drag_cursor(self, on: bool) -> Self

The time cursor follows the pointer when dragged; where it went is PlotOutput::cursor_dragged (default: off; on with a timeline).

Source

pub fn time_scale(self, scale: TimeScale) -> Self

The x axis in a timeline’s scale: x values are seconds, the ticks and labels the timeline ruler’s (1:05, 00:00:02:10, 17.2).

Source

pub fn timeline(self, state: &'a mut TimelineState) -> Self

Follows a timeline: its scale on the x axis, its playhead as the time cursor, its range highlighted; dragging the cursor moves the playhead (on the scale’s units, inside its bounds). Draw the timeline in the same pass, before or after: each shows what the other did.

Source

pub fn highlight_range(self, range: Option<TimeRange>) -> Self

A span of x highlighted under the series (a timeline’s range); a timeline given by Plot::timeline gives its own.

Source

pub fn bands(self, bands: &'a [Band]) -> Self

Error bands under the lines (Band).

Source

pub fn values_tooltip(self, on: bool) -> Self

While the pointer is over the plot, a tooltip lists every line’s value at its x, marked on the lines (default: on with a time scale or a timeline).

Source

pub fn emphasize(self, series: Option<usize>) -> Self

Draws one series thicker, the one an application has selected or hovered elsewhere.

Source

pub fn x_label(self, label: impl Into<String>) -> Self

The x axis’ title.

Source

pub fn y_label(self, label: impl Into<String>) -> Self

The y axis’ title.

Source

pub fn legend(self, on: bool) -> Self

Shows the legend (default: with two series or more).

Zooms and pans the x axis together with the other plots of group (egui_plot’s linked axes).

Shows the pointer’s x as a line in the other plots of group (egui_plot’s linked cursors).

Source

pub fn interactive(self, on: bool) -> Self

Takes the zoom, the pan and the box zoom (default: on).

Source

pub fn bar_width(self, width: f64) -> Self

The width a bar takes of the space between two x values, shared by the bar series side by side (default: 0.8).

Source

pub fn color_of(palette: &DataPalette, series: &Series, index: usize) -> Color32

The colour series index is drawn in.

Source

pub fn show(self, ui: &mut Ui) -> PlotOutput

Trait Implementations§

Source§

impl<'a> Debug for Plot<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for Plot<'a>

§

impl<'a> RefUnwindSafe for Plot<'a>

§

impl<'a> Send for Plot<'a>

§

impl<'a> Sync for Plot<'a>

§

impl<'a> Unpin for Plot<'a>

§

impl<'a> UnsafeUnpin for Plot<'a>

§

impl<'a> !UnwindSafe for Plot<'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
§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

§

impl<T> Downcast for T
where T: 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.
§

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

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

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

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

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

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

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 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

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

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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

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

§

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

§

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

§

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

impl<T> Upcast<T> for T

§

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

§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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

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

§

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

§

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

§

impl<T> WasmNotSend for T
where T: Send,

§

impl<T> WasmNotSendSync for T
where T: WasmNotSend + WasmNotSync,

§

impl<T> WasmNotSync for T
where T: Sync,