pub struct Sparkline<'a> { /* private fields */ }Expand description
A single-row sparkline of samples, scaled to the sample max, using the
eight vertical block glyphs ▁▂▃▄▅▆▇█.
The most recent samples are right-aligned so the graph scrolls left as
new data arrives. By default, bar height and color track each sample’s
fraction of the max via Meter (a green-to-red load ramp); call
Sparkline::style to draw every bar in one fixed color instead, height
only, the right choice once the color channel would otherwise imply
something the data doesn’t mean (e.g. a frame-time graph, where “tallest
bar in view” isn’t the same thing as “bad”: super::PerfOverlay does
this). Only the first row of area is drawn.
Unlike super::BoxBorder, super::Gauge, super::StatBar,
super::Table, and super::Button, Sparkline has no theme()/
theme_on() pair: Meter already gives its bars a semantic
green-to-red color, and a fixed Sparkline::style override has no
single Theme role to map onto either.
§Examples
use retroglyph_core::grid::{Grid, Rect};
use retroglyph_ui::{Surface, Sparkline, Widget};
let samples = [1.0, 3.0, 2.0, 4.0, 1.5];
let mut grid = Grid::new(10, 1);
let area = Rect::new(0, 0, 10, 1);
Sparkline::new(&samples).render(&mut Surface::new(&mut grid, area, 0));Implementations§
Trait Implementations§
impl<'a> Copy for Sparkline<'a>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<C> WithAlpha for Cwhere
C: Copy,
impl<C> WithAlpha for Cwhere
C: Copy,
§fn with_alpha_first<A>(self, alpha: A) -> AlphaFirst<A, Self>
fn with_alpha_first<A>(self, alpha: A) -> AlphaFirst<A, Self>
self with alpha, storing alpha before the color in memory
(see [AlphaFirst]).§fn with_alpha_last<A>(self, alpha: A) -> AlphaLast<A, Self>
fn with_alpha_last<A>(self, alpha: A) -> AlphaLast<A, Self>
self with alpha, storing alpha after the color in memory
(see [AlphaLast]).