pub struct AxisTransform { /* private fields */ }Expand description
Maps data-space coordinates along one axis to pixel positions.
An axis transform stores origin, span, pixel count, optional log scale, and optional flip (used for the y-axis so that higher values appear at the top of the terminal).
Implementations§
Source§impl AxisTransform
impl AxisTransform
Sourcepub fn new(
origin: f64,
span: f64,
pixels: usize,
scale: Scale,
flip: bool,
) -> Option<Self>
pub fn new( origin: f64, span: f64, pixels: usize, scale: Scale, flip: bool, ) -> Option<Self>
Creates a new axis transform. Returns None when origin or span
is non-finite, span is zero, or pixels is zero.
Sourcepub fn data_to_pixel(self, value: f64) -> Option<i32>
pub fn data_to_pixel(self, value: f64) -> Option<i32>
Converts a data-space value to a pixel coordinate.
Returns None for non-finite values, values outside the log domain
(zero or negative with a log scale), or results that overflow i32.
Trait Implementations§
Source§impl Clone for AxisTransform
impl Clone for AxisTransform
Source§fn clone(&self) -> AxisTransform
fn clone(&self) -> AxisTransform
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for AxisTransform
impl Debug for AxisTransform
Source§impl PartialEq for AxisTransform
impl PartialEq for AxisTransform
impl Copy for AxisTransform
impl StructuralPartialEq for AxisTransform
Auto Trait Implementations§
impl Freeze for AxisTransform
impl RefUnwindSafe for AxisTransform
impl Send for AxisTransform
impl Sync for AxisTransform
impl Unpin for AxisTransform
impl UnsafeUnpin for AxisTransform
impl UnwindSafe for AxisTransform
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