pub struct Bullet { /* private fields */ }Expand description
Bullet chart widget (one row per item, shared scale 0..max).
§Example
use ratatui::{buffer::Buffer, layout::Rect, widgets::Widget};
use tui_chart::{Bullet, BulletItem};
let chart = Bullet::new([BulletItem::new("Revenue", 270.0).target(300.0)]);
let area = Rect::new(0, 0, 40, 12);
let mut buf = Buffer::empty(area);
chart.render(area, &mut buf);Implementations§
Source§impl Bullet
impl Bullet
Sourcepub fn new(items: impl IntoIterator<Item = BulletItem>) -> Self
pub fn new(items: impl IntoIterator<Item = BulletItem>) -> Self
Create a bullet chart.
Sourcepub fn max(self, m: f64) -> Self
pub fn max(self, m: f64) -> Self
Fixed scale maximum shared by all rows (default: each row is scaled to its own largest value/target/range, so mixed units work).
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).
Trait Implementations§
Source§impl Themed for Bullet
Available on crate feature theme only.
impl Themed for Bullet
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 Forget for Bullet
impl Freeze for Bullet
impl RefUnwindSafe for Bullet
impl Send for Bullet
impl Sync for Bullet
impl Unpin for Bullet
impl UnsafeUnpin for Bullet
impl UnwindSafe for Bullet
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