pub struct ChartTooltip { /* private fields */ }Expand description
What a Chart says about the category under the pointer or the arrow keys.
use ravenrs_widgets::{ChartIndicator, ChartTooltip};
let tooltip = ChartTooltip::new()
.indicator(ChartIndicator::Line)
.label_format(|month| format!("Month of {month}"))
.show_total("Total");Implementations§
Source§impl ChartTooltip
impl ChartTooltip
Sourcepub fn indicator(self, indicator: ChartIndicator) -> Self
pub fn indicator(self, indicator: ChartIndicator) -> Self
How each row shows its color.
Sourcepub fn hide_label(self) -> Self
pub fn hide_label(self) -> Self
Leaves out the category on top.
Sourcepub fn label(self, label: impl Into<String>) -> Self
pub fn label(self, label: impl Into<String>) -> Self
Writes this on top, in place of the category.
Sourcepub fn label_format(self, format: impl Fn(&str) -> String + 'static) -> Self
pub fn label_format(self, format: impl Fn(&str) -> String + 'static) -> Self
Writes the category on top in another way, such as a date in full.
Sourcepub fn value_format(self, format: impl Fn(f64) -> String + 'static) -> Self
pub fn value_format(self, format: impl Fn(f64) -> String + 'static) -> Self
Writes values in another way than on the axis, such as with their unit.
Sourcepub fn show_total(self, name: impl Into<String>) -> Self
pub fn show_total(self, name: impl Into<String>) -> Self
Adds a last row with the sum of the series, under this name.
Sourcepub fn show_percent(self) -> Self
pub fn show_percent(self) -> Self
Writes after each value its share: of the circle in a pie or a doughnut, of the category in the others.
Sourcepub fn value_color(
self,
color: impl Fn(usize, f64) -> Option<Semantic> + 'static,
) -> Self
pub fn value_color( self, color: impl Fn(usize, f64) -> Option<Semantic> + 'static, ) -> Self
Colors a value by what it says, such as a loss in red. It is given the index
of the series and the value; None leaves it in the color of the text.
Sourcepub fn no_indicator_for(self, series: impl Into<String>) -> Self
pub fn no_indicator_for(self, series: impl Into<String>) -> Self
The row of this series has no square or bar, for a value that is not one of those the chart tells apart, such as a target.
Trait Implementations§
Source§impl Clone for ChartTooltip
impl Clone for ChartTooltip
Source§fn clone(&self) -> ChartTooltip
fn clone(&self) -> ChartTooltip
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ChartTooltip
impl Debug for ChartTooltip
Source§impl Default for ChartTooltip
impl Default for ChartTooltip
Source§fn default() -> ChartTooltip
fn default() -> ChartTooltip
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for ChartTooltip
impl !Send for ChartTooltip
impl !Sync for ChartTooltip
impl !UnwindSafe for ChartTooltip
impl Freeze for ChartTooltip
impl Unpin for ChartTooltip
impl UnsafeUnpin for ChartTooltip
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