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: PlotToolThe tool the primary button uses.
selection: Option<Bounds>The selected area in data coordinates.
Names of the hidden series.
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: f64When that hover began, for the animation clock.
pipeline: PipelineFilters and transforms applied to the visible series.
measurement_customized: boolWhether the user changed the measurement settings from the panel.
settings_open: boolWhether the chart-settings dialog is open.
toolbar_pinned: boolWhether the tool ribbon stays unrolled.
toolbar_reveal: f32Ribbon reveal fraction, animated.
toolbar_anchor: Option<[f32; 2]>Dragged ribbon position relative to the plot frame.
Implementations§
Source§impl ViewState
impl ViewState
Sourcepub fn cached_extent(&self, fingerprint: u64) -> Option<Bounds>
pub fn cached_extent(&self, fingerprint: u64) -> Option<Bounds>
The cached extent of a series with fingerprint, if it is current.
Sourcepub fn legend_hover(&self) -> Option<usize>
pub fn legend_hover(&self) -> Option<usize>
The series whose legend row the pointer is over.
Sourcepub fn legend_hover_start(&self) -> f64
pub fn legend_hover_start(&self) -> f64
When the current legend hover began.
Sourcepub fn set_legend_hover(&mut self, series: Option<usize>, now: f64)
pub fn set_legend_hover(&mut self, series: Option<usize>, now: f64)
Set the hovered legend row and restart the animation when it changes.
Sourcepub fn hovered_series(&self) -> Option<usize>
pub fn hovered_series(&self) -> Option<usize>
The series whose legend row is under the pointer, if any.
Sourcepub fn reset_view(&mut self)
pub fn reset_view(&mut self)
Fit the view to the data again.
Sourcepub fn is_auto(&self) -> bool
pub fn is_auto(&self) -> bool
Whether the view follows the data (no zoom or pan since the last reset).
Sourcepub fn set_view(&mut self, bounds: Bounds)
pub fn set_view(&mut self, bounds: Bounds)
Show bounds (data coordinates, linear axes) on the x and left y axes.
Sourcepub fn set_y2_view(&mut self, min: f64, max: f64)
pub fn set_y2_view(&mut self, min: f64, max: f64)
Show min..=max (data coordinates, linear axis) on the right y axis.
Sourcepub fn pipeline_mut(&mut self) -> &mut Pipeline
pub fn pipeline_mut(&mut self) -> &mut Pipeline
The filter/transform pipeline, mutably.
Sourcepub fn toggle_filter(&mut self, filter: FilterKind)
pub fn toggle_filter(&mut self, filter: FilterKind)
Enable or disable one filter.
Sourcepub fn set_filter(&mut self, filter: FilterKind, enabled: bool)
pub fn set_filter(&mut self, filter: FilterKind, enabled: bool)
Enable or disable one filter explicitly.
Sourcepub fn set_transform(&mut self, transform: Option<TransformKind>)
pub fn set_transform(&mut self, transform: Option<TransformKind>)
Replace the transform.
Sourcepub fn clear_analysis(&mut self)
pub fn clear_analysis(&mut self)
Disable every filter and transform.
Sourcepub fn pin_toolbar(&mut self, pinned: bool)
pub fn pin_toolbar(&mut self, pinned: bool)
Pin the tool ribbon open or let it unroll on hover.
Sourcepub fn collapse_toolbar(&mut self)
pub fn collapse_toolbar(&mut self)
Collapse the ribbon and unpin it.
Sourcepub fn legend_position(&self) -> Option<[f32; 2]>
pub fn legend_position(&self) -> Option<[f32; 2]>
Where the legend was dragged to, as fractions of the room around it.
Sourcepub fn set_legend_position(&mut self, position: Option<[f32; 2]>)
pub fn set_legend_position(&mut self, position: Option<[f32; 2]>)
Place the legend; None returns it to its configured corner.
Whether the legend has hidden the series called name.
Show or hide a series by name.
Sourcepub fn has_overlays(&self) -> bool
pub fn has_overlays(&self) -> bool
Whether the view or the analysis would be cleared by a reset.