pub struct Funnel { /* private fields */ }Expand description
Funnel chart widget: centered bars whose width follows the value.
§Example
use ratatui::{buffer::Buffer, layout::Rect, widgets::Widget};
use tui_chart::{Funnel, FunnelStage};
let chart = Funnel::new([FunnelStage::new("Visits", 1000.0), FunnelStage::new("Signups", 240.0)]);
let area = Rect::new(0, 0, 40, 12);
let mut buf = Buffer::empty(area);
chart.render(area, &mut buf);Implementations§
Source§impl Funnel
impl Funnel
Sourcepub fn new(stages: impl IntoIterator<Item = FunnelStage>) -> Self
pub fn new(stages: impl IntoIterator<Item = FunnelStage>) -> Self
Create a funnel from stages (first stage is the 100 % reference).
Sourcepub fn show_percent(self, v: bool) -> Self
pub fn show_percent(self, v: bool) -> Self
Show conversion percentage vs. the first stage (default on).
Sourcepub fn show_dropoff(self, v: bool) -> Self
pub fn show_dropoff(self, v: bool) -> Self
Show the drop-off vs. the previous stage (default on).
Sourcepub fn taper(self, v: bool) -> Self
pub fn taper(self, v: bool) -> Self
Connect stages into one tapering funnel (default on); off draws separate bars.
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).
Hide stages by index. The label stays (dimmed) so the stage can be
toggled back, see Interaction.
Sourcepub fn conversions(&self) -> Vec<f64>
pub fn conversions(&self) -> Vec<f64>
Conversion of each stage relative to the first (0..=1; 0 if the first is 0).
Trait Implementations§
Source§impl Themed for Funnel
Available on crate feature theme only.
impl Themed for Funnel
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 Funnel
impl RefUnwindSafe for Funnel
impl Send for Funnel
impl Sync for Funnel
impl Unpin for Funnel
impl UnsafeUnpin for Funnel
impl UnwindSafe for Funnel
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