Skip to main content

Coord

Trait Coord 

Source
pub trait Coord: Send + Sync {
    // Required method
    fn transform(&self, point: (f64, f64), plot_area: &Rect) -> (f64, f64);

    // Provided methods
    fn gridlines(&self) -> bool { ... }
    fn is_flipped(&self) -> bool { ... }
    fn zoom_x(&self) -> Option<(f64, f64)> { ... }
    fn zoom_y(&self) -> Option<(f64, f64)> { ... }
    fn set_domains(&mut self, _x: Option<AxisSpan>, _y: Option<AxisSpan>) { ... }
}
Expand description

Trait for coordinate systems.

Required Methods§

Source

fn transform(&self, point: (f64, f64), plot_area: &Rect) -> (f64, f64)

Transform normalized (0..1, 0..1) coordinates to pixel coordinates.

Provided Methods§

Source

fn gridlines(&self) -> bool

Whether to draw grid lines.

Source

fn is_flipped(&self) -> bool

Whether this coordinate system flips X and Y.

Source

fn zoom_x(&self) -> Option<(f64, f64)>

Zoom limits for x-axis (data coordinates). Clips viewport without filtering data.

Source

fn zoom_y(&self) -> Option<(f64, f64)>

Zoom limits for y-axis (data coordinates). Clips viewport without filtering data.

Source

fn set_domains(&mut self, _x: Option<AxisSpan>, _y: Option<AxisSpan>)

Supply the trained x/y axis spans after scale training. Coordinate systems that warp the axis (e.g. coord_trans) need this to map a normalized position back to a data value. Default is a no-op.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§