Skip to main content

ChartWindow

Struct ChartWindow 

Source
pub struct ChartWindow<T: 'static> { /* private fields */ }
Expand description

A “last N points per series” streaming projection over a ChartModel<T>.

See the module documentation for semantics.

Implementations§

Source§

impl<T: 'static> ChartWindow<T>

Source

pub fn new(source: ChartModel<T>, window_size: usize) -> Self

Wrap source, showing only the last window_size points of every series.

Source

pub fn window_size(&self) -> usize

The configured window size.

Source

pub fn set_window_size(&self, window_size: usize)

Change the window size, rebuilding every series and emitting ChartChange::Reset.

Source

pub fn series_count(&self) -> usize

Number of series (same set as the source).

Source

pub fn series_ids(&self) -> Vec<SeriesId>

The series ids, in the source’s display order.

Source

pub fn point_count(&self, series: SeriesId) -> usize

Number of points currently visible in the window for series.

Source

pub fn with_series<R>( &self, series: SeriesId, f: impl FnOnce(&str, Option<&ColorProp>, bool) -> R, ) -> Option<R>

Access a series’ metadata (delegates straight through to the source). Returns None if series is unknown.

Source

pub fn with_point<R>( &self, series: SeriesId, index: usize, f: impl FnOnce(&ChartDatum<T>) -> R, ) -> Option<R>

Access the point at window-local index within series. Returns None if series is unknown or index is outside the window.

Source

pub fn observe_changes( &self, f: impl Fn(&ChartChange) + 'static, ) -> ObserverHandle

Register an observer for translated window changes. Returns an ObserverHandle — dropping it removes the callback.

Source

pub fn first_changed_index(&self, series: SeriesId) -> Option<usize>

First window-local index of series whose content may differ since the latest translated change. Per-series (chart data is 2-level: series, then points), unlike SortFilterListModel::first_changed_index’s single flat value. None if series is unknown or unaffected yet.

Trait Implementations§

Source§

impl<T: 'static> Clone for ChartWindow<T>

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<T: 'static> Debug for ChartWindow<T>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<T> !RefUnwindSafe for ChartWindow<T>

§

impl<T> !Send for ChartWindow<T>

§

impl<T> !Sync for ChartWindow<T>

§

impl<T> !UnwindSafe for ChartWindow<T>

§

impl<T> Freeze for ChartWindow<T>

§

impl<T> Unpin for ChartWindow<T>

§

impl<T> UnsafeUnpin for ChartWindow<T>

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