Skip to main content

Module format

Module format 

Source
Expand description

Public value and label formatting helpers.

format_value renders a single data Value the way ggplot-rs shows it in hover tooltips (rounded numbers, calendar dates for datetimes). The label_* axis/legend formatters from crate::scale::format are re-exported here so hosts can format numbers consistently with the plot.

Re-exports§

pub use crate::locale::CurrencyPosition;
pub use crate::locale::Locale;
pub use crate::scale::format::label_bytes;
pub use crate::scale::format::label_comma;
pub use crate::scale::format::label_comma_locale;
pub use crate::scale::format::label_comma_marks;
pub use crate::scale::format::label_currency;
pub use crate::scale::format::label_currency_locale;
pub use crate::scale::format::label_currency_marks;
pub use crate::scale::format::label_dollar;
pub use crate::scale::format::label_number;
pub use crate::scale::format::label_number_locale;
pub use crate::scale::format::label_number_marks;
pub use crate::scale::format::label_ordinal;
pub use crate::scale::format::label_percent;
pub use crate::scale::format::label_percent_locale;
pub use crate::scale::format::label_percent_marks;
pub use crate::scale::format::label_scientific;
pub use crate::scale::format::label_si;
pub use crate::scale::format::LabelFormatter;

Functions§

format_timestamp
Format a timestamp (seconds since the Unix epoch, UTC) with the same strftime subset the datetime scales use for their labels — %Y %y %m %-m %b %B %d %-d %e %a %A %H %M %S %% — and the month / weekday names of locale (English without). For hosts that format a date the way an axis would, e.g. in their own tooltips.
format_value
Format one data value for display (tooltips, data labels):
format_value_locale
format_value in the conventions of locale: numbers get its decimal and thousands marks, datetimes its date format and month names.