pub struct BoxPlot { /* private fields */ }Expand description
Box-and-whisker chart widget.
§Example
use ratatui::{buffer::Buffer, layout::Rect, widgets::Widget};
use tui_chart::{BoxPlot};
let chart = BoxPlot::new().group("a", (1..=20).map(|x| x as f64)).group("b", (5..=30).map(|x| x as f64));
let area = Rect::new(0, 0, 40, 12);
let mut buf = Buffer::empty(area);
chart.render(area, &mut buf);Implementations§
Source§impl BoxPlot
impl BoxPlot
Sourcepub fn group(
self,
label: impl Into<String>,
samples: impl IntoIterator<Item = f64>,
) -> Self
pub fn group( self, label: impl Into<String>, samples: impl IntoIterator<Item = f64>, ) -> Self
Add a group computed from raw samples (uses the current whisker factor,
so call BoxPlot::whisker_iqr first if you change it).
Sourcepub fn stats(self, label: impl Into<String>, stats: BoxStats) -> Self
pub fn stats(self, label: impl Into<String>, stats: BoxStats) -> Self
Add a group from precomputed statistics.
Sourcepub fn whisker_iqr(self, v: f64) -> Self
pub fn whisker_iqr(self, v: f64) -> Self
Whisker length as a multiple of the IQR (default 1.5).
Sourcepub fn theme(self, theme: impl Into<Theme>) -> Self
pub fn theme(self, theme: impl Into<Theme>) -> Self
Apply a Theme: palette group colors, outlier (bear) color, axis
colors and background fill. Explicit BoxPlot::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 orientation(self, v: BoxOrientation) -> Self
pub fn orientation(self, v: BoxOrientation) -> Self
Orientation.
Sourcepub fn show_outliers(self, v: bool) -> Self
pub fn show_outliers(self, v: bool) -> Self
Draw outliers (default on).
Sourcepub fn notched(self, v: bool) -> Self
pub fn notched(self, v: bool) -> Self
Notch the box around the median’s ~95 % confidence interval
(1.58 × IQR / √n); needs the sample count (default off).
Trait Implementations§
Source§impl Themed for BoxPlot
Available on crate feature theme only.
impl Themed for BoxPlot
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 BoxPlot
impl Freeze for BoxPlot
impl Move for BoxPlot
impl RefUnwindSafe for BoxPlot
impl Send for BoxPlot
impl Sync for BoxPlot
impl Unpin for BoxPlot
impl UnsafeUnpin for BoxPlot
impl UnwindSafe for BoxPlot
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