Skip to main content

ContinuousScale

Trait ContinuousScale 

Source
pub trait ContinuousScale {
    // Required methods
    fn map(&self, value: f64) -> f64;
    fn domain(&self) -> (f64, f64);
    fn range(&self) -> (f64, f64);
    fn ticks(&self, count: usize) -> Vec<f64>;
    fn clamp(&self, value: f64) -> f64;
}
Expand description

Common interface for continuous scales. Note: Each scale type also has its own specific methods beyond this trait.

Required Methods§

Source

fn map(&self, value: f64) -> f64

Map a domain value to a range value.

Source

fn domain(&self) -> (f64, f64)

Get the domain extent as (min, max).

Source

fn range(&self) -> (f64, f64)

Get the range extent as (min, max).

Source

fn ticks(&self, count: usize) -> Vec<f64>

Generate approximately count nice tick values within the domain.

Source

fn clamp(&self, value: f64) -> f64

Clamp a value to domain bounds.

Implementors§