pub enum ValueFormat {
Compact,
Fixed(usize),
}Expand description
How a chart writes values on axes, bars and summaries.
use rich_ext::chart::ValueFormat;
assert_eq!(ValueFormat::Compact.format(1_234.0), "1.2k");
assert_eq!(ValueFormat::Compact.format(3_400_000.0), "3.4M");
assert_eq!(ValueFormat::Compact.format(0.25), "0.25");
assert_eq!(ValueFormat::Fixed(1).format(2.0), "2.0");Variants§
Compact
Short forms: 950, 0.25, 12.5, then 1.2k, 3.4M, 5.0B
(format::compact from a thousand up, at most two decimals
below), and 1.0e15 from a thousand trillion. A chart axis or
histogram whose round values this cannot write exactly (2015
would read 2.0k) writes them in full instead.
Fixed(usize)
A fixed number of decimals: Fixed(2) writes 3.14. At most
MAX_DECIMALS are written; more are capped.
Implementations§
Trait Implementations§
Source§impl Clone for ValueFormat
impl Clone for ValueFormat
impl Copy for ValueFormat
Source§impl Debug for ValueFormat
impl Debug for ValueFormat
Source§impl Default for ValueFormat
impl Default for ValueFormat
impl Eq for ValueFormat
Source§impl Hash for ValueFormat
impl Hash for ValueFormat
Source§impl PartialEq for ValueFormat
impl PartialEq for ValueFormat
impl StructuralPartialEq for ValueFormat
Auto Trait Implementations§
impl Freeze for ValueFormat
impl RefUnwindSafe for ValueFormat
impl Send for ValueFormat
impl Sync for ValueFormat
impl Unpin for ValueFormat
impl UnsafeUnpin for ValueFormat
impl UnwindSafe for ValueFormat
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.