pub struct Waterfall { /* private fields */ }Expand description
Waterfall chart widget.
§Example
use ratatui::{buffer::Buffer, layout::Rect, widgets::Widget};
use tui_chart::{Waterfall};
let chart = Waterfall::new().delta("Sales", 50.0).delta("Costs", -20.0).total("Net");
let area = Rect::new(0, 0, 40, 12);
let mut buf = Buffer::empty(area);
chart.render(area, &mut buf);Implementations§
Source§impl Waterfall
impl Waterfall
Sourcepub fn delta(self, label: impl Into<String>, v: f64) -> Self
pub fn delta(self, label: impl Into<String>, v: f64) -> Self
Add a delta step (non-finite deltas count as 0).
Sourcepub fn total(self, label: impl Into<String>) -> Self
pub fn total(self, label: impl Into<String>) -> Self
Add a total bar showing the running total so far.
Sourcepub fn colors(self, up: Color, down: Color, total: Color) -> Self
pub fn colors(self, up: Color, down: Color, total: Color) -> Self
Colors for increases, decreases and totals.
Sourcepub fn theme(self, theme: impl Into<Theme>) -> Self
pub fn theme(self, theme: impl Into<Theme>) -> Self
Apply a Theme: bull/bear/neutral bar colors, axis/label colors and
background fill. Explicit Waterfall::colors win.
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 marker(self, v: Marker) -> Self
pub fn marker(self, v: Marker) -> Self
Draw connectors as dot lines (e.g. Marker::Braille, a thin
sub-cell line at the exact level) instead of ┄ (the default).
Sourcepub fn connectors(self, v: bool) -> Self
pub fn connectors(self, v: bool) -> Self
Draw connector lines between bars (default on).
Sourcepub fn show_values(self, v: bool) -> Self
pub fn show_values(self, v: bool) -> Self
Print values above/below bars (default on).
Trait Implementations§
Source§impl Themed for Waterfall
Available on crate feature theme only.
impl Themed for Waterfall
Available on crate feature
theme only.Source§fn apply_theme(self, theme: &Theme) -> Self
fn apply_theme(self, theme: &Theme) -> Self
Return
self styled from theme. Explicit per-item colors set on the
widget should keep winning over the theme.Source§fn themed(self, provider: &impl ThemeProvider) -> Self
fn themed(self, provider: &impl ThemeProvider) -> Self
Apply the theme produced by any
ThemeProvider.Auto Trait Implementations§
impl Freeze for Waterfall
impl RefUnwindSafe for Waterfall
impl Send for Waterfall
impl Sync for Waterfall
impl Unpin for Waterfall
impl UnsafeUnpin for Waterfall
impl UnwindSafe for Waterfall
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