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>
impl<T: 'static> ChartWindow<T>
Sourcepub fn new(source: ChartModel<T>, window_size: usize) -> Self
pub fn new(source: ChartModel<T>, window_size: usize) -> Self
Wrap source, showing only the last window_size points of every
series.
Sourcepub fn window_size(&self) -> usize
pub fn window_size(&self) -> usize
The configured window size.
Sourcepub fn set_window_size(&self, window_size: usize)
pub fn set_window_size(&self, window_size: usize)
Change the window size, rebuilding every series and emitting
ChartChange::Reset.
Sourcepub fn series_count(&self) -> usize
pub fn series_count(&self) -> usize
Number of series (same set as the source).
Sourcepub fn series_ids(&self) -> Vec<SeriesId>
pub fn series_ids(&self) -> Vec<SeriesId>
The series ids, in the source’s display order.
Sourcepub fn point_count(&self, series: SeriesId) -> usize
pub fn point_count(&self, series: SeriesId) -> usize
Number of points currently visible in the window for series.
Sourcepub fn with_series<R>(
&self,
series: SeriesId,
f: impl FnOnce(&str, Option<&ColorProp>, bool) -> R,
) -> Option<R>
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.
Sourcepub fn with_point<R>(
&self,
series: SeriesId,
index: usize,
f: impl FnOnce(&ChartDatum<T>) -> R,
) -> Option<R>
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.
Sourcepub fn observe_changes(
&self,
f: impl Fn(&ChartChange) + 'static,
) -> ObserverHandle
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.
Sourcepub fn first_changed_index(&self, series: SeriesId) -> Option<usize>
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.