Skip to main content

PlotState

Struct PlotState 

Source
pub struct PlotState {
    pub annotations: Vec<PlotAnnotation>,
    pub measurements: Vec<PlotMeasurement>,
    pub measurement: MeasurementConfig,
    pub measurement_label_offsets: Vec<[f32; 2]>,
    /* private fields */
}
Expand description

The interactive state of one plot. Keep it in the application model.

Fields§

§annotations: Vec<PlotAnnotation>

Text notes, arrows, spans, and regions.

§measurements: Vec<PlotMeasurement>

Distance and area measurements drawn over the data.

§measurement: MeasurementConfig

Live measurement settings. The chart config seeds them until the user edits them.

§measurement_label_offsets: Vec<[f32; 2]>

Screen offset, in points, the user dragged each measurement label by. Index aligned with measurements; missing entries mean no offset.

Implementations§

Source§

impl PlotState

Source

pub fn measurement_label_offset(&self, index: usize) -> Vec2

The offset, in points, the label of measurement index was dragged by.

Source

pub fn move_measurement_label(&mut self, index: usize, delta: Vec2)

Move the label of measurement index by delta points.

Source

pub fn measurements(&self) -> &[PlotMeasurement]

Every distance and area measurement, in the order they were added.

Source

pub fn add_measurement(&mut self, measurement: PlotMeasurement)

Add a measurement. The plot draws it on the next frame.

Source

pub fn remove_measurement(&mut self, index: usize) -> Option<PlotMeasurement>

Remove the measurement at index.

Source

pub fn pop_measurement(&mut self) -> Option<PlotMeasurement>

Remove the newest measurement and return it.

Source

pub fn clear_measurements(&mut self)

Remove every measurement.

Source

pub fn pipeline(&self) -> &Pipeline

The filter/transform pipeline.

Source

pub fn pipeline_mut(&mut self) -> &mut Pipeline

The filter/transform pipeline, mutably.

Source

pub fn toggle_filter(&mut self, filter: FilterKind)

Enable or disable one filter.

Source

pub fn set_filter(&mut self, filter: FilterKind, enabled: bool)

Enable or disable one filter explicitly.

Source

pub fn set_transform(&mut self, transform: Option<TransformKind>)

Replace the transform. A new transform clears measurements because the data domain changed.

Source

pub fn clear_analysis(&mut self)

Disable every filter and transform.

Source

pub fn set_measurement(&mut self, measurement: MeasurementConfig)

Replace the live measurement settings and mark them user-edited.

Source

pub fn clear_overlays(&mut self)

Clear every painted overlay: measurements, selection, annotations, and analysis.

Source

pub fn has_overlays(&self) -> bool

Whether a clear action would remove anything.

Methods from Deref<Target = ViewState>§

Source

pub fn cached_extent(&self, fingerprint: u64) -> Option<Bounds>

The cached extent of a series with fingerprint, if it is current.

Source

pub fn legend_hover(&self) -> Option<usize>

The series whose legend row the pointer is over.

Source

pub fn legend_hover_start(&self) -> f64

When the current legend hover began.

Source

pub fn set_legend_hover(&mut self, series: Option<usize>, now: f64)

Set the hovered legend row and restart the animation when it changes.

Source

pub fn hovered_series(&self) -> Option<usize>

The series whose legend row is under the pointer, if any.

Source

pub fn reset_view(&mut self)

Fit the view to the data again.

Source

pub fn is_auto(&self) -> bool

Whether the view follows the data (no zoom or pan since the last reset).

Source

pub fn view(&self) -> Option<Bounds>

The explicit view, or None while automatic.

Source

pub fn set_view(&mut self, bounds: Bounds)

Show bounds (data coordinates, linear axes) on the x and left y axes.

Source

pub fn set_y2_view(&mut self, min: f64, max: f64)

Show min..=max (data coordinates, linear axis) on the right y axis.

Source

pub fn pipeline(&self) -> &Pipeline

The filter/transform pipeline.

Source

pub fn pipeline_mut(&mut self) -> &mut Pipeline

The filter/transform pipeline, mutably.

Source

pub fn toggle_filter(&mut self, filter: FilterKind)

Enable or disable one filter.

Source

pub fn set_filter(&mut self, filter: FilterKind, enabled: bool)

Enable or disable one filter explicitly.

Source

pub fn set_transform(&mut self, transform: Option<TransformKind>)

Replace the transform.

Source

pub fn clear_analysis(&mut self)

Disable every filter and transform.

Source

pub fn pin_toolbar(&mut self, pinned: bool)

Pin the tool ribbon open or let it unroll on hover.

Source

pub fn collapse_toolbar(&mut self)

Collapse the ribbon and unpin it.

Source

pub fn legend_position(&self) -> Option<[f32; 2]>

Where the legend was dragged to, as fractions of the room around it.

Source

pub fn set_legend_position(&mut self, position: Option<[f32; 2]>)

Place the legend; None returns it to its configured corner.

Source

pub fn is_hidden(&self, name: &str) -> bool

Whether the legend has hidden the series called name.

Source

pub fn set_hidden(&mut self, name: &str, hidden: bool)

Show or hide a series by name.

Source

pub fn has_overlays(&self) -> bool

Whether the view or the analysis would be cleared by a reset.

Trait Implementations§

Source§

impl Clone for PlotState

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PlotState

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for PlotState

Source§

fn default() -> Self

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

impl Deref for PlotState

Source§

type Target = ViewState

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl DerefMut for PlotState

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl<'de> Deserialize<'de> for PlotState

Available on crate feature serde only.
Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for PlotState

Available on crate feature serde only.
Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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

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

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> SerializableAny for T
where T: 'static + Any + Clone + for<'a> Send + Sync,

Source§

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

Source§

fn simd_from(_simd: S, value: T) -> 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

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