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 new() -> ChartTooltip
pub fn new() -> ChartTooltip
A tooltip with the category on top and a square before each series.
Sourcepub fn indicator(self, indicator: ChartIndicator) -> ChartTooltip
pub fn indicator(self, indicator: ChartIndicator) -> ChartTooltip
How each row shows its color.
Sourcepub fn hide_label(self) -> ChartTooltip
pub fn hide_label(self) -> ChartTooltip
Leaves out the category on top.
Sourcepub fn label(self, label: impl Into<String>) -> ChartTooltip
pub fn label(self, label: impl Into<String>) -> ChartTooltip
Writes this on top, in place of the category.
Sourcepub fn label_format(
self,
format: impl Fn(&str) -> String + 'static,
) -> ChartTooltip
pub fn label_format( self, format: impl Fn(&str) -> String + 'static, ) -> ChartTooltip
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,
) -> ChartTooltip
pub fn value_format( self, format: impl Fn(f64) -> String + 'static, ) -> ChartTooltip
Writes values in another way than on the axis, such as with their unit.
Sourcepub fn show_total(self, name: impl Into<String>) -> ChartTooltip
pub fn show_total(self, name: impl Into<String>) -> ChartTooltip
Adds a last row with the sum of the series, under this name.
Sourcepub fn icons(self) -> ChartTooltip
pub fn icons(self) -> ChartTooltip
Shows the icons of the series in place of their colors.
Sourcepub fn show_percent(self) -> ChartTooltip
pub fn show_percent(self) -> ChartTooltip
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,
) -> ChartTooltip
pub fn value_color( self, color: impl Fn(usize, f64) -> Option<Semantic> + 'static, ) -> ChartTooltip
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>) -> ChartTooltip
pub fn no_indicator_for(self, series: impl Into<String>) -> ChartTooltip
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.
Sourcepub fn content(
self,
content: impl Fn(usize, &str) -> Box<dyn View> + 'static,
) -> ChartTooltip
pub fn content( self, content: impl Fn(usize, &str) -> Box<dyn View> + 'static, ) -> ChartTooltip
Writes the panel with a view of your own, given the index and the name of the category. A screen reader still hears the values.
Sourcepub fn no_cursor(self) -> ChartTooltip
pub fn no_cursor(self) -> ChartTooltip
Leaves out the strip or line that marks the category on the chart.
Trait Implementations§
Source§impl Clone for ChartTooltip
impl Clone for ChartTooltip
Source§fn clone(&self) -> ChartTooltip
fn clone(&self) -> ChartTooltip
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more