pub fn format_value(v: &Value) -> StringExpand description
Format one data value for display (tooltips, data labels):
- strings as-is, booleans as
true/false,NAas the empty string; - numbers rounded to three decimals with trailing zeros dropped
(
3.14159→"3.142",2.0→"2"); - datetimes (epoch seconds) as
YYYY-MM-DD[ HH:MM:SS]UTC.
use ggplot_rs::data::Value;
use ggplot_rs::format::format_value;
assert_eq!(format_value(&Value::Float(3.14159)), "3.142");
assert_eq!(format_value(&Value::DateTime(86_400)), "1970-01-02");
assert_eq!(format_value(&Value::Na), "");