pub struct Sparkline<'a> { /* private fields */ }Expand description
Compact trend chart, one column per data point (newest points kept when too wide).
Implementations§
Source§impl<'a> Sparkline<'a>
impl<'a> Sparkline<'a>
Sourcepub fn new(data: impl IntoIterator<Item = f64>) -> Self
pub fn new(data: impl IntoIterator<Item = f64>) -> Self
Create a sparkline from values. Non-finite values are skipped.
Sourcepub fn style(self, v: SparklineStyle) -> Self
pub fn style(self, v: SparklineStyle) -> Self
Bar or line style.
Sourcepub fn theme_gradient(self, v: bool) -> Self
pub fn theme_gradient(self, v: bool) -> Self
Color by value along the theme gradient (needs a theme; an explicit
Sparkline::gradient wins).
Sourcepub fn base_style(self, style: Style) -> Self
pub fn base_style(self, style: Style) -> Self
Base style painted over the whole area (beats the theme).
Sourcepub fn gradient(self, colors: impl IntoIterator<Item = Color>) -> Self
pub fn gradient(self, colors: impl IntoIterator<Item = Color>) -> Self
Color gradient by value, from low to high (overrides base color).
Sourcepub fn highlight_last(self, v: Color) -> Self
pub fn highlight_last(self, v: Color) -> Self
Highlight the last point.
Sourcepub fn highlight_min(self, v: Color) -> Self
pub fn highlight_min(self, v: Color) -> Self
Highlight the minimum point.
Sourcepub fn highlight_max(self, v: Color) -> Self
pub fn highlight_max(self, v: Color) -> Self
Highlight the maximum point.
Sourcepub fn marker(self, v: Marker) -> Self
pub fn marker(self, v: Marker) -> Self
Glyph family used for dot drawing (default Marker::Braille).
Sourcepub fn smooth(self, v: usize) -> Self
pub fn smooth(self, v: usize) -> Self
Moving-average window (default 1 = raw); tames noisy series.
Sourcepub fn win_loss_colors(self, win: Color, loss: Color) -> Self
pub fn win_loss_colors(self, win: Color, loss: Color) -> Self
Colors for SparklineStyle::WinLoss (win, loss).
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Sparkline<'a>
impl<'a> RefUnwindSafe for Sparkline<'a>
impl<'a> Send for Sparkline<'a>
impl<'a> Sync for Sparkline<'a>
impl<'a> Unpin for Sparkline<'a>
impl<'a> UnsafeUnpin for Sparkline<'a>
impl<'a> UnwindSafe for Sparkline<'a>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> ⓘ
Converts
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> ⓘ
Converts
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