Skip to main content

LiveSeries

Struct LiveSeries 

Source
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

Source

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.

Source

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.

Source

pub fn x_name(&self) -> &str

The name of the x column.

Source

pub fn y_name(&self) -> &str

The name of the y column.

Source

pub fn is_resolved(&self) -> bool

Whether the table last synced has numeric columns of these names (after another table, it may not).

Source

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.

Trait Implementations§

Source§

impl Clone for LiveSeries

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 Debug for LiveSeries

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.