pub struct Chart {Show 15 fields
pub chart_type: ChartType,
pub series: Vec<Series>,
pub axes: Vec<Axis>,
pub title: Option<ChartTitle>,
pub subtitle: Option<ChartTitle>,
pub legend: Option<LegendConfig>,
pub background_color: Color,
pub bar_config: BarConfig,
pub padding: f32,
pub text_annotations: Vec<TextAnnotation>,
pub line_annotations: Vec<LineAnnotation>,
pub fill_regions: Vec<FillRegion>,
pub interactive: InteractiveState,
pub show_crosshair: bool,
pub show_tooltips: bool,
}Expand description
Complete chart data.
Fields§
§chart_type: ChartTypeChart type
series: Vec<Series>Data series
axes: Vec<Axis>All axes (indexed by AxisId)
title: Option<ChartTitle>Main title
subtitle: Option<ChartTitle>Subtitle
legend: Option<LegendConfig>Legend configuration
background_color: ColorBackground color
bar_config: BarConfigBar configuration (if bar chart)
padding: f32Padding around the chart area
text_annotations: Vec<TextAnnotation>Text annotations
line_annotations: Vec<LineAnnotation>Line annotations
fill_regions: Vec<FillRegion>Fill regions
interactive: InteractiveStateInteractive state
show_crosshair: boolWhether to show crosshair on hover
show_tooltips: boolWhether to show tooltips on hover
Implementations§
Source§impl Chart
impl Chart
Sourcepub fn append_data(&mut self, series_idx: usize, points: &[DataPoint])
pub fn append_data(&mut self, series_idx: usize, points: &[DataPoint])
Sourcepub fn push_point(
&mut self,
series_idx: usize,
point: DataPoint,
max_points: Option<usize>,
)
pub fn push_point( &mut self, series_idx: usize, point: DataPoint, max_points: Option<usize>, )
Push a single data point to a series with an optional sliding window.
If max_points is Some, the oldest points will be removed to keep
the series at or below the specified size. This is useful for
real-time charts that show a fixed time window.
§Example
// Keep only the last 1000 points
chart.push_point(0, DataPoint::new(timestamp, value), Some(1000));Sourcepub fn clear_data(&mut self, series_idx: usize)
pub fn clear_data(&mut self, series_idx: usize)
Clear all data from a series.
Sourcepub fn series_mut(&mut self, series_idx: usize) -> Option<&mut Series>
pub fn series_mut(&mut self, series_idx: usize) -> Option<&mut Series>
Get mutable access to a series for direct manipulation.
Sourcepub fn series_len(&self, series_idx: usize) -> usize
pub fn series_len(&self, series_idx: usize) -> usize
Get the number of data points in a series.
Sourcepub fn total_points(&self) -> usize
pub fn total_points(&self) -> usize
Get the total number of data points across all series.
Sourcepub fn get_axis_mut(&mut self, id: AxisId) -> Option<&mut Axis>
pub fn get_axis_mut(&mut self, id: AxisId) -> Option<&mut Axis>
Get a mutable axis by ID.
Sourcepub fn data_bounds_for_axis(&self, axis_id: AxisId) -> Option<(f64, f64)>
pub fn data_bounds_for_axis(&self, axis_id: AxisId) -> Option<(f64, f64)>
Get the combined bounds of all series for a specific axis.
Sourcepub fn data_bounds(&self) -> Option<(DataPoint, DataPoint)>
pub fn data_bounds(&self) -> Option<(DataPoint, DataPoint)>
Get the combined bounds of all series.
Sourcepub fn axis_range(&self, axis_id: AxisId) -> (f64, f64)
pub fn axis_range(&self, axis_id: AxisId) -> (f64, f64)
Get the effective range for an axis.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Chart
impl RefUnwindSafe for Chart
impl Send for Chart
impl Sync for Chart
impl Unpin for Chart
impl UnsafeUnpin for Chart
impl UnwindSafe for Chart
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more