Skip to main content

Module chart_change

Module chart_change 

Source
Expand description

ChartChange — change notifications and stable series identifiers for chart collections.

SeriesId is an opaque, stable handle for a series in a crate::ChartModel. Because ChartModel is backed by a slotmap, SeriesId values survive arbitrary series insertions, removals, and reorders — only removing the series itself invalidates it. ChartChange describes exactly what mutated (at the series level or the point level within a series) so that projections (ChartWindow, ChartAggregate) and consumers (ChartSelection) can refresh or adjust incrementally instead of rebuilding from scratch.

Consumers typically receive ChartChange values through an observer registered via crate::ChartModel::observe_changes, which fires synchronously (before the registering call returns) after each mutation.

// ChartModel::observe_changes returns an ObserverHandle whose drop
// unregisters the callback — keep it alive for the observer's lifetime.
use teksilo_data::{ChartModel, ChartChange};
let model: ChartModel<String> = ChartModel::new();
let _handle = model.observe_changes(|change| {
    println!("{change:?}");
});
model.add_series("Revenue");
// prints: SeriesInserted { index: 0, series: SeriesId(...) }

Structs§

SeriesId
Opaque identifier for a series in a ChartModel.

Enums§

ChartChange
Describes a mutation to a chart’s series or point data. Emitted by ChartModel<T> automatically.