pub struct BarChart { /* private fields */ }Expand description
A horizontal bar chart.
Build it from (label, value) pairs and render it through the
Renderable pipeline. Bars are scaled to the largest value (or to an
explicit with_max); each bar fills proportionally
using full blocks plus a fractional partial block for sub-cell precision.
Implementations§
Source§impl BarChart
impl BarChart
Sourcepub fn from_pairs<S: Into<String>>(
pairs: impl IntoIterator<Item = (S, f64)>,
) -> Self
pub fn from_pairs<S: Into<String>>( pairs: impl IntoIterator<Item = (S, f64)>, ) -> Self
Build a chart from an iterator of (label, value) pairs.
Sourcepub fn push(&mut self, label: impl Into<String>, value: f64) -> &mut Self
pub fn push(&mut self, label: impl Into<String>, value: f64) -> &mut Self
Append a bar, returning &mut Self for fluent calls on an owned value.
Sourcepub fn with_bar(self, label: impl Into<String>, value: f64) -> Self
pub fn with_bar(self, label: impl Into<String>, value: f64) -> Self
Append a bar (chainable, consuming builder form).
Sourcepub fn with_width(self, width: usize) -> Self
pub fn with_width(self, width: usize) -> Self
Set the total row width in cells (builder pattern).
When unset, the chart fills ConsoleOptions::max_width.
Sourcepub fn with_max(self, max: f64) -> Self
pub fn with_max(self, max: f64) -> Self
Set an explicit scale maximum (builder pattern).
Values are scaled against this instead of the data maximum. A zero or negative maximum is guarded: every bar renders empty.
Sourcepub fn with_bar_style(self, style: Style) -> Self
pub fn with_bar_style(self, style: Style) -> Self
Set the style applied to the bar glyphs (builder pattern).
Sourcepub fn with_label_style(self, style: Style) -> Self
pub fn with_label_style(self, style: Style) -> Self
Set the style applied to the labels (builder pattern).
Sourcepub fn with_value_style(self, style: Style) -> Self
pub fn with_value_style(self, style: Style) -> Self
Set the style applied to the formatted values (builder pattern).
Sourcepub fn with_show_values(self, show: bool) -> Self
pub fn with_show_values(self, show: bool) -> Self
Set whether formatted values are shown (builder pattern; default true).
Trait Implementations§
Source§impl Renderable for BarChart
impl Renderable for BarChart
Source§fn gilt_console(
&self,
_console: &Console,
options: &ConsoleOptions,
) -> Vec<Segment>
fn gilt_console( &self, _console: &Console, options: &ConsoleOptions, ) -> Vec<Segment>
Source§fn gilt_measure(
&self,
_console: &Console,
options: &ConsoleOptions,
) -> Measurement
fn gilt_measure( &self, _console: &Console, options: &ConsoleOptions, ) -> Measurement
Auto Trait Implementations§
impl Freeze for BarChart
impl RefUnwindSafe for BarChart
impl Send for BarChart
impl Sync for BarChart
impl Unpin for BarChart
impl UnsafeUnpin for BarChart
impl UnwindSafe for BarChart
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,
Source§impl<T> RenderableExt for Twhere
T: Renderable + 'static,
impl<T> RenderableExt for Twhere
T: Renderable + 'static,
Source§fn into_boxed_renderable(self) -> RenderableBox
fn into_boxed_renderable(self) -> RenderableBox
RenderableBox for type-erased storage. Read moreSource§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
CompactString. Read more