pub struct PlotSpec {
pub marks: Vec<Mark>,
pub x: Axis,
pub y: Axis,
pub style: PlotStyle,
pub crosshair: bool,
pub y_autoscale: bool,
pub x_autoscale: bool,
pub controls: PlotControls,
pub legend: Option<LegendPosition>,
pub downsample: Option<Decimation>,
}Expand description
Fields§
§marks: Vec<Mark>The marks, drawn in order.
x: AxisHorizontal-axis configuration.
y: AxisVertical-axis configuration.
style: PlotStylePlot-level styling.
crosshair: boolWhether to show a crosshair reading out the nearest sample.
y_autoscale: boolWhether the vertical axis auto-fits to the data visible in the current horizontal window each frame (vs. a fixed Y window).
x_autoscale: boolWhether the horizontal axis auto-fits to the full data extent each
frame (vs. sticking at the window it was first seeded with). On by
default so a plot whose series grow — a streaming dashboard fed by
SeriesHandle::append — keeps
the new samples in view. Any manual X gesture (pan, wheel zoom, X
box-zoom) or crate::state::UiState::set_plot_view takes manual
control and stops the tracking until a double-click reset or a
PlotRequest::FitAll. With
static data the re-fit resolves to the same window every frame, so
this is invisible for non-streaming plots.
controls: PlotControlsPointer control scheme — what the primary drag does (see
PlotControls).
legend: Option<LegendPosition>Legend placement, or None for no legend.
downsample: Option<Decimation>Library-side down-sampling for over-dense line series (the
dump-everything path). None draws every sample; Some reduces each
line to the pixel budget over the visible window before upload. A
virtual app that resamples its own source leaves this None.
Implementations§
Source§impl PlotSpec
impl PlotSpec
Sourcepub fn line(self, series: &SeriesHandle) -> Self
pub fn line(self, series: &SeriesHandle) -> Self
Add a default-styled line mark for series.
Sourcepub fn scatter(self, series: &SeriesHandle) -> Self
pub fn scatter(self, series: &SeriesHandle) -> Self
Add a default-styled scatter mark for series.
Sourcepub fn add_mark(self, mark: impl Into<Mark>) -> Self
pub fn add_mark(self, mark: impl Into<Mark>) -> Self
Add a fully-built mark (the escape hatch for styled marks, e.g.
spec.add_mark(line(&h).color(c).width(2.0))).
Sourcepub fn crosshair(self, on: bool) -> Self
pub fn crosshair(self, on: bool) -> Self
Set whether to draw the crosshair / nearest-sample readout.
Sourcepub fn y_autoscale(self, on: bool) -> Self
pub fn y_autoscale(self, on: bool) -> Self
Set whether the vertical axis auto-scales to the visible window.
Sourcepub fn x_autoscale(self, on: bool) -> Self
pub fn x_autoscale(self, on: bool) -> Self
Set whether the horizontal axis auto-scales to the full data extent
each frame (see Self::x_autoscale; on by default). Turn this off
for a plot that should hold a fixed time window regardless of what
the series contain.
Sourcepub fn controls(self, controls: PlotControls) -> Self
pub fn controls(self, controls: PlotControls) -> Self
Set the pointer control scheme (what the primary drag does). Defaults
to PlotControls::ZoomDrag.
Sourcepub fn legend(self, position: LegendPosition) -> Self
pub fn legend(self, position: LegendPosition) -> Self
Show a legend at position. Series are labelled by their
label, falling back to "Series N".
Sourcepub fn downsample(self, decimation: Decimation) -> Self
pub fn downsample(self, decimation: Decimation) -> Self
Enable library-side down-sampling of line series to the pixel budget (the dump-everything path). Leave unset for the virtual-data flow.
Sourcepub fn background(self, color: Color) -> Self
pub fn background(self, color: Color) -> Self
Set the data-rect background fill.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PlotSpec
impl RefUnwindSafe for PlotSpec
impl Send for PlotSpec
impl Sync for PlotSpec
impl Unpin for PlotSpec
impl UnsafeUnpin for PlotSpec
impl UnwindSafe for PlotSpec
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.