pub struct Transform {
pub frame: ScreenRect,
pub view: Bounds,
pub x_scale: Scale,
pub y_scale: Scale,
pub y2: Option<SecondAxis>,
}Expand description
Maps data to screen and back. Works in “scaled” space (log10 already applied), so zoom and pan are linear in what the user sees.
Fields§
§frame: ScreenRectThe data area on screen.
view: BoundsVisible range in scaled units.
x_scale: ScaleThe horizontal scale.
y_scale: ScaleThe left vertical scale.
y2: Option<SecondAxis>The right axis: its visible range in scaled units, and its scale.
Implementations§
Source§impl Transform
impl Transform
Sourcepub fn for_axis(self, axis: YAxis) -> Self
pub fn for_axis(self, axis: YAxis) -> Self
The transform for series on axis: the right axis swaps in its range and scale.
Sourcepub fn to_screen(self, point: [f64; 2]) -> ScreenPoint
pub fn to_screen(self, point: [f64; 2]) -> ScreenPoint
Map a data point to screen coordinates.
Sourcepub fn scaled_to_screen(&self, x: f64, y: f64) -> ScreenPoint
pub fn scaled_to_screen(&self, x: f64, y: f64) -> ScreenPoint
Map scaled coordinates to screen coordinates.
Sourcepub fn to_scaled(self, pos: ScreenPoint) -> [f64; 2]
pub fn to_scaled(self, pos: ScreenPoint) -> [f64; 2]
Map a screen position to scaled coordinates.
Sourcepub fn to_data(self, pos: ScreenPoint) -> [f64; 2]
pub fn to_data(self, pos: ScreenPoint) -> [f64; 2]
Map a screen position to data coordinates.
Sourcepub fn units_per_point(&self) -> [f64; 2]
pub fn units_per_point(&self) -> [f64; 2]
Data units per screen point, in scaled space.
Trait Implementations§
Auto Trait Implementations§
impl Forget for Transform
impl Freeze for Transform
impl Move for Transform
impl RefUnwindSafe for Transform
impl Send for Transform
impl Sync for Transform
impl Unpin for Transform
impl UnsafeUnpin for Transform
impl UnwindSafe for Transform
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