pub struct Dataset {
pub schema: DataSchema,
pub records: Vec<DataRecord>,
}Expand description
The shared shape. Tables render it; charts build series by field key.
Fields§
§schema: DataSchema§records: Vec<DataRecord>Implementations§
Source§impl Dataset
impl Dataset
pub fn new(schema: DataSchema, records: Vec<DataRecord>) -> Self
pub fn from_records(schema: DataSchema, records: Vec<DataRecord>) -> Self
Sourcepub fn from_text_rows(
fields: impl IntoIterator<Item = (String, String)>,
rows: impl IntoIterator<Item = (String, HashMap<String, String>)>,
) -> Self
pub fn from_text_rows( fields: impl IntoIterator<Item = (String, String)>, rows: impl IntoIterator<Item = (String, HashMap<String, String>)>, ) -> Self
Build a dataset from text field definitions and (id, cells) rows.
pub fn field_keys(&self) -> impl Iterator<Item = &str>
Sourcepub fn column_as_numbers(
&self,
field: &str,
) -> Result<Vec<f64>, ProjectionError>
pub fn column_as_numbers( &self, field: &str, ) -> Result<Vec<f64>, ProjectionError>
Extract a numeric column for chart value axes.
Accepts DataValue::Number. DataValue::Null maps to f64::NAN as a gap.
Sourcepub fn column_as_categories(
&self,
field: &str,
) -> Result<Vec<String>, ProjectionError>
pub fn column_as_categories( &self, field: &str, ) -> Result<Vec<String>, ProjectionError>
Extract a categorical column for band/point axes.
Accepts text, category, date, number, and bool variants (stringified).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Dataset
impl<'de> Deserialize<'de> for Dataset
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for Dataset
Auto Trait Implementations§
impl Freeze for Dataset
impl RefUnwindSafe for Dataset
impl Send for Dataset
impl Sync for Dataset
impl Unpin for Dataset
impl UnsafeUnpin for Dataset
impl UnwindSafe for Dataset
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more