pub struct ChartState { /* private fields */ }Expand description
A fixed categorical dataset and its interactive inspection/legend state.
The numeric range includes zero and only visible series. The empty or all-zero
dataset uses 0..1; negative values are supported without a false baseline.
A Stacked layout’s range covers each category’s positive and negative sums.
Implementations§
Source§impl ChartState
impl ChartState
pub fn new<L: Into<SharedString>>( categories: impl IntoIterator<Item = L>, series: impl IntoIterator<Item = ChartSeries>, cx: &mut Context<'_, Self>, ) -> Self
pub fn categories(&self) -> &[SharedString]
pub fn series(&self) -> &[ChartSeries]
pub fn is_visible(&self, index: usize) -> bool
pub fn inspected_index(&self) -> Option<usize>
pub fn focus_handle(&self) -> &FocusHandle
pub fn set_visible( &mut self, index: usize, visible: bool, window: &mut Window, cx: &mut Context<'_, Self>, ) -> bool
pub fn layout(&self) -> ChartLayout
Sourcepub fn set_layout(
&mut self,
layout: ChartLayout,
window: &mut Window,
cx: &mut Context<'_, Self>,
) -> bool
pub fn set_layout( &mut self, layout: ChartLayout, window: &mut Window, cx: &mut Context<'_, Self>, ) -> bool
Arranges the same data differently; visibility and inspection are kept.
pub fn inspect( &mut self, index: usize, window: &mut Window, cx: &mut Context<'_, Self>, ) -> bool
Sourcepub fn range(&self) -> (f64, f64)
pub fn range(&self) -> (f64, f64)
The visible domain is recomputed only when series visibility changes, so normalizing every plotted point remains linear in the dataset size.
Sourcepub fn stack_span(&self, series: usize, category: usize) -> Option<(f64, f64)>
pub fn stack_span(&self, series: usize, category: usize) -> Option<(f64, f64)>
The (start, end) values of a visible series segment in a Stacked
layout. Earlier visible series of the same sign lie closer to zero.
Returns None for a hidden series.
Sourcepub fn pie_slices(&self) -> Vec<(f32, f32)>
pub fn pie_slices(&self) -> Vec<(f32, f32)>
Each category’s (start, end) pie slice in turns. A category whose
visible-series total is zero or negative receives an empty slice; with
no positive total every slice is empty.
Sourcepub fn radar_turn(&self, category: usize) -> f32
pub fn radar_turn(&self, category: usize) -> f32
The spoke angle of a Radar category in turns.
Sourcepub fn normalized_value(&self, value: f64) -> f32
pub fn normalized_value(&self, value: f64) -> f32
A unit height above the visible data range’s lower bound.
pub fn inspected_description(&self) -> SharedString
Sourcepub fn inspected_description_with(
&self,
format_value: impl Fn(f64) -> String,
) -> SharedString
pub fn inspected_description_with( &self, format_value: impl Fn(f64) -> String, ) -> SharedString
Describe the inspected category using the application’s value formatting.
Trait Implementations§
impl EventEmitter<ChartEvent> for ChartState
Auto Trait Implementations§
impl !RefUnwindSafe for ChartState
impl !UnwindSafe for ChartState
impl Forget for ChartState
impl Freeze for ChartStatewhere
*const u8 is !null: Freeze,
PhantomData<SharedString>: Freeze,
PhantomData<ChartSeries>: Freeze,
PhantomData<bool>: Freeze,
NonZero<u32>: Freeze,
*const ArcInner<RwLock<RawRwLock, FocusMap>> is !null: Freeze,
PhantomData<ArcInner<RwLock<RawRwLock, FocusMap>>>: Freeze,
impl Move for ChartState
impl Send for ChartState
impl Sync for ChartState
impl Unpin for ChartState
impl UnsafeUnpin for ChartStatewhere
*const u8 is !null: UnsafeUnpin,
PhantomData<SharedString>: UnsafeUnpin,
PhantomData<ChartSeries>: UnsafeUnpin,
PhantomData<bool>: UnsafeUnpin,
NonZeroU32Inner: UnsafeUnpin,
*const ArcInner<RwLock<RawRwLock, FocusMap>> is !null: UnsafeUnpin,
PhantomData<ArcInner<RwLock<RawRwLock, FocusMap>>>: UnsafeUnpin,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ErasedDestructor for Twhere
T: 'static,
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