#[non_exhaustive]pub enum ChartKind {
Sparkline,
Line,
Bar,
BarGrouped,
}Expand description
Chart visualisation kind.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Sparkline
Single-row inline chart (no axes, no labels).
Line
Multi-series line chart with axes. Per-series fill enables area fill.
Bar
Vertical bar chart with category labels.
Multiple series stack: each x-position paints one coloured
segment per series, bottom-up in series order, and the bar’s
total height is the column sum. A single-series chart is exactly
a plain bar chart — stacking is a no-op there.
With two or more series and an auto-derived range (no explicit
y_range), the floor is anchored at 0.0 specifically so
segment proportions are correct — see Chart::effective_y_range.
An explicit y_range whose floor isn’t 0.0 still skews every
segment’s proportion relative to the others, since the geometry
has no way to know which value the caller intends as “empty”;
pass y_range: Some((0.0, …)) if you need one. If the explicit
range excludes 0.0 altogether (e.g. Some((-10.0, -2.0))) the
stack’s baseline lands on whichever plot edge is nearer zero and
segments are clipped to the range rather than vanishing, but the
proportions on screen are then the caller’s to justify.
BarGrouped
Vertical bar chart whose series are drawn side by side
within each x-position, for comparing magnitudes rather than
composition. Use ChartKind::Bar to compare totals instead.
Each slot is split into series.len() sub-bars. When a slot is
too narrow to give every series at least one device unit, the
trailing series are clipped — widen the chart or drop a series.
(The TUI backend clips exactly this way; GTK and macOS instead
floor each sub-bar to 1px and let them overlap rather than
dropping data — both are acceptable outcomes for a pathologically
narrow chart, but they render differently from each other.)
Implementations§
Source§impl ChartKind
impl ChartKind
Sourcepub fn is_bar(self) -> bool
pub fn is_bar(self) -> bool
True for every bar-family kind (ChartKind::Bar,
ChartKind::BarGrouped).
Sourcepub fn is_stacked_bar(self) -> bool
pub fn is_stacked_bar(self) -> bool
True when bar segments accumulate per x-position rather than sitting side by side.
Trait Implementations§
impl Copy for ChartKind
Source§impl<'de> Deserialize<'de> for ChartKind
impl<'de> Deserialize<'de> for ChartKind
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>,
impl Eq for ChartKind
impl StructuralPartialEq for ChartKind
Auto Trait Implementations§
impl Freeze for ChartKind
impl RefUnwindSafe for ChartKind
impl Send for ChartKind
impl Sync for ChartKind
impl Unpin for ChartKind
impl UnsafeUnpin for ChartKind
impl UnwindSafe for ChartKind
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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