pub struct ChartSeries {
pub name: String,
pub points: Vec<ChartPoint>,
}Expand description
A named, ordered sequence of chart points.
§Examples
use ailloli_ui_core::ChartSeries;
let series = ChartSeries::from_values("latency", [4.0, 7.0]);
assert_eq!(series.points[1].x, 1.0);
assert_eq!(series.points[1].y, 7.0);Fields§
§name: StringConsumer-facing series label; an empty label is allowed.
points: Vec<ChartPoint>Points in render and traversal order.
Implementations§
Source§impl ChartSeries
impl ChartSeries
Sourcepub fn new(
name: impl Into<String>,
points: impl IntoIterator<Item = ChartPoint>,
) -> Self
pub fn new( name: impl Into<String>, points: impl IntoIterator<Item = ChartPoint>, ) -> Self
Collects an ordered point iterator into a named series.
§Examples
use ailloli_ui_core::{ChartPoint, ChartSeries};
let series = ChartSeries::new("cpu", [ChartPoint::new(1.0, 2.0)]);
assert_eq!(series.points.len(), 1);Sourcepub fn from_values(
name: impl Into<String>,
values: impl IntoIterator<Item = f32>,
) -> Self
pub fn from_values( name: impl Into<String>, values: impl IntoIterator<Item = f32>, ) -> Self
Builds a series whose x coordinates are zero-based input indices.
Indices are converted to f32; values, including non-finite values, are
preserved as y coordinates.
§Examples
use ailloli_ui_core::ChartSeries;
let series = ChartSeries::from_values("cpu", [2.0, 3.0]);
assert_eq!(series.points[1].x, 1.0);Sourcepub fn from_xy(
name: impl Into<String>,
points: impl IntoIterator<Item = (f32, f32)>,
) -> Self
pub fn from_xy( name: impl Into<String>, points: impl IntoIterator<Item = (f32, f32)>, ) -> Self
Builds a series from (x, y) pairs without normalizing coordinates.
§Examples
use ailloli_ui_core::ChartSeries;
let series = ChartSeries::from_xy("cpu", [(4.0, 8.0)]);
assert_eq!(series.points[0].y, 8.0);Trait Implementations§
Source§impl Clone for ChartSeries
impl Clone for ChartSeries
Source§fn clone(&self) -> ChartSeries
fn clone(&self) -> ChartSeries
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ChartSeries
impl Debug for ChartSeries
Source§impl Default for ChartSeries
impl Default for ChartSeries
Source§fn default() -> ChartSeries
fn default() -> ChartSeries
Returns the “default value” for a type. Read more
Source§impl PartialEq for ChartSeries
impl PartialEq for ChartSeries
impl StructuralPartialEq for ChartSeries
Auto Trait Implementations§
impl Freeze for ChartSeries
impl RefUnwindSafe for ChartSeries
impl Send for ChartSeries
impl Sync for ChartSeries
impl Unpin for ChartSeries
impl UnwindSafe for ChartSeries
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