pub struct LiveSeries { /* private fields */ }Expand description
Two columns of a densa_data::LiveTable read as numbers, x and y, so a view of the
table is a densa_chart series (points).
Integers, Float32, Float64 and Decimal128 read as their value; timestamps as
seconds since the epoch (whatever their unit and time zone: instants are UTC), and dates
as the seconds of their midnight, so time columns go straight onto a time axis. Other
types (Float16, Decimal256, times of day, durations, dictionaries) are not numeric
here. Nulls are gaps.
A chart needs x ascending: give a view sorted by the x column, ascending. Its nulls
sort last, past every point a chart looks for, so they cost nothing; a descending view
draws wrong.
Like LiveGrid, it keeps a handle to each batch’s two arrays, brought up
to date by sync, which allocates only when batches were added or
compacted; reading points allocates nothing. Until it is synced after a change,
points gives nothing (never values from the wrong batch): sync it right
after changing the table, and before painting. Given another table, it finds its columns
again by name.
Implementations§
Source§impl LiveSeries
impl LiveSeries
Sourcepub fn new(table: &LiveTable, x: &str, y: &str) -> Result<Self, SeriesError>
pub fn new(table: &LiveTable, x: &str, y: &str) -> Result<Self, SeriesError>
A series of table’s columns named x and y.
§Errors
SeriesError::NoSuchColumn or SeriesError::NotNumeric for either column.
Sourcepub fn sync(&mut self, table: &LiveTable)
pub fn sync(&mut self, table: &LiveTable)
Takes in table’s batches added or compacted since the last call (or another
table: its columns are found again by name). Call it after the table changed, before
reading points.
Sourcepub fn is_resolved(&self) -> bool
pub fn is_resolved(&self) -> bool
Whether the table last synced has numeric columns of these names (after another table, it may not).
Sourcepub fn points<'a>(
&'a self,
table: &'a LiveTable,
view: ViewId,
) -> Option<SeriesPoints<'a>>
pub fn points<'a>( &'a self, table: &'a LiveTable, view: ViewId, ) -> Option<SeriesPoints<'a>>
The rows of view as points, in the view’s order, or None if the view does not
exist, the table changed since sync (never values from the wrong
batch), or the table has no numeric columns of the names given.