Skip to main content

ViewState

Struct ViewState 

Source
pub struct ViewState {
Show 16 fields pub view: Option<Bounds>, pub tool: PlotTool, pub selection: Option<Bounds>, pub hidden: Vec<String>, pub export_menu: bool, pub y2_view: Option<[f64; 2]>, pub legend_pos: Option<[f32; 2]>, pub extents: Vec<(u64, Bounds)>, pub legend_hover: Option<usize>, pub legend_hover_start: f64, pub pipeline: Pipeline, pub measurement_customized: bool, pub settings_open: bool, pub toolbar_pinned: bool, pub toolbar_reveal: f32, pub toolbar_anchor: Option<[f32; 2]>,
}
Expand description

The egui-free half of a plot’s state. The UI crate keeps the annotations, the measurements, and the live drag in its adapter.

Fields§

§view: Option<Bounds>

The explicit view, or None while automatic.

§tool: PlotTool

The tool the primary button uses.

§selection: Option<Bounds>

The selected area in data coordinates.

§hidden: Vec<String>

Names of the hidden series.

§export_menu: bool

Whether the toolbar’s export menu is open.

§y2_view: Option<[f64; 2]>

The right axis range in scaled units, once zoomed or panned.

§legend_pos: Option<[f32; 2]>

Where the dragged legend sits: 0–1 across the room left in the frame.

§extents: Vec<(u64, Bounds)>

Series extents by fingerprint, so the automatic view does not walk every point of every series each frame.

§legend_hover: Option<usize>

The series whose legend row the pointer is over.

§legend_hover_start: f64

When that hover began, for the animation clock.

§pipeline: Pipeline

Filters and transforms applied to the visible series.

§measurement_customized: bool

Whether the user changed the measurement settings from the panel.

§settings_open: bool

Whether the chart-settings dialog is open.

§toolbar_pinned: bool

Whether the tool ribbon stays unrolled.

§toolbar_reveal: f32

Ribbon reveal fraction, animated.

§toolbar_anchor: Option<[f32; 2]>

Dragged ribbon position relative to the plot frame.

Implementations§

Source§

impl 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 ViewState

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 ViewState

Source§

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

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

impl Default for ViewState

Source§

fn default() -> Self

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

impl<'de> Deserialize<'de> for ViewState

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 ViewState

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