Skip to main content

ChartTooltip

Struct ChartTooltip 

Source
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

Source

pub fn new() -> Self

A tooltip with the category on top and a square before each series.

Source

pub fn indicator(self, indicator: ChartIndicator) -> Self

How each row shows its color.

Source

pub fn hide_label(self) -> Self

Leaves out the category on top.

Source

pub fn label(self, label: impl Into<String>) -> Self

Writes this on top, in place of the category.

Source

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.

Source

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.

Source

pub fn show_total(self, name: impl Into<String>) -> Self

Adds a last row with the sum of the series, under this name.

Source

pub fn icons(self) -> Self

Shows the icons of the series in place of their colors.

Source

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.

Source

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.

Source

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.

Source

pub fn content(self, content: impl Fn(usize, &str) -> AnyView + 'static) -> Self

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.

Source

pub fn no_cursor(self) -> Self

Leaves out the strip or line that marks the category on the chart.

Trait Implementations§

Source§

impl Clone for ChartTooltip

Source§

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)

Performs copy-assignment from source. Read more
Source§

impl Debug for ChartTooltip

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ChartTooltip

Source§

fn default() -> ChartTooltip

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more