Trait Scale

Source
pub trait Scale<T> {
    // Required methods
    fn get_type(&self) -> ScaleType;
    fn scale(&self, domain: &T) -> f32;
    fn bandwidth(&self) -> Option<f32>;
    fn range_start(&self) -> f32;
    fn range_end(&self) -> f32;
    fn get_ticks(&self) -> Vec<T>;

    // Provided method
    fn is_range_reversed(&self) -> bool { ... }
}
Expand description

The Scale trait defines common operations on all scales.

Required Methods§

Source

fn get_type(&self) -> ScaleType

Get the type of the scale.

Source

fn scale(&self, domain: &T) -> f32

Get the range value for the given domain entry.

Source

fn bandwidth(&self) -> Option<f32>

Get the bandwidth (if present).

Source

fn range_start(&self) -> f32

Get the start range value.

Source

fn range_end(&self) -> f32

Get the end range value.

Source

fn get_ticks(&self) -> Vec<T>

Get the list of ticks that represent the scale on a chart axis.

Provided Methods§

Source

fn is_range_reversed(&self) -> bool

Check whether the range is in reversed order, meaning the start is greater than the end.

Implementors§