pub struct LinearAxis<T, C: PixelColor> { /* private fields */ }Expand description
Linear axis implementation with automatic tick generation
Implementations§
Source§impl<T, C> LinearAxis<T, C>
impl<T, C> LinearAxis<T, C>
Sourcepub fn new(
min: T,
max: T,
orientation: AxisOrientation,
position: AxisPosition,
) -> Self
pub fn new( min: T, max: T, orientation: AxisOrientation, position: AxisPosition, ) -> Self
Create a new linear axis
Sourcepub fn with_tick_generator(self, generator: LinearTickGenerator) -> Self
pub fn with_tick_generator(self, generator: LinearTickGenerator) -> Self
Set the tick generator
Sourcepub fn with_style(self, style: AxisStyle<C>) -> Self
pub fn with_style(self, style: AxisStyle<C>) -> Self
Set the axis style
Sourcepub fn with_range(self, min: T, max: T) -> Self
pub fn with_range(self, min: T, max: T) -> Self
Set the range of the axis
Sourcepub fn show_ticks(self, show: bool) -> Self
pub fn show_ticks(self, show: bool) -> Self
Enable or disable tick marks
Sourcepub fn show_labels(self, show: bool) -> Self
pub fn show_labels(self, show: bool) -> Self
Enable or disable labels
Sourcepub fn draw_grid_lines<D>(
&self,
viewport: Rectangle,
chart_area: Rectangle,
target: &mut D,
) -> ChartResult<()>where
D: DrawTarget<Color = C>,
pub fn draw_grid_lines<D>(
&self,
viewport: Rectangle,
chart_area: Rectangle,
target: &mut D,
) -> ChartResult<()>where
D: DrawTarget<Color = C>,
Draw only grid lines (public method for LineChart)
Sourcepub fn draw_axis_only<D>(
&self,
viewport: Rectangle,
target: &mut D,
) -> ChartResult<()>where
D: DrawTarget<Color = C>,
pub fn draw_axis_only<D>(
&self,
viewport: Rectangle,
target: &mut D,
) -> ChartResult<()>where
D: DrawTarget<Color = C>,
Draw only axis line, ticks, and labels (without grid lines)
Trait Implementations§
Source§impl<T, C> Axis<T, C> for LinearAxis<T, C>
impl<T, C> Axis<T, C> for LinearAxis<T, C>
Source§type TickGenerator = LinearTickGenerator
type TickGenerator = LinearTickGenerator
The tick generator type for this axis
Source§fn orientation(&self) -> AxisOrientation
fn orientation(&self) -> AxisOrientation
Get the axis orientation
Source§fn position(&self) -> AxisPosition
fn position(&self) -> AxisPosition
Get the axis position
Source§fn transform_value(&self, value: T, viewport: Rectangle) -> i32
fn transform_value(&self, value: T, viewport: Rectangle) -> i32
Transform a data value to screen coordinate Read more
Source§fn inverse_transform(&self, coordinate: i32, viewport: Rectangle) -> T
fn inverse_transform(&self, coordinate: i32, viewport: Rectangle) -> T
Transform a screen coordinate back to data value Read more
Source§fn tick_generator(&self) -> &Self::TickGenerator
fn tick_generator(&self) -> &Self::TickGenerator
Get the tick generator for this axis
Source§fn draw<D>(&self, viewport: Rectangle, target: &mut D) -> ChartResult<()>where
D: DrawTarget<Color = C>,
fn draw<D>(&self, viewport: Rectangle, target: &mut D) -> ChartResult<()>where
D: DrawTarget<Color = C>,
Draw the axis to the target Read more
Source§fn required_space(&self) -> u32
fn required_space(&self) -> u32
Calculate the space required for this axis (labels, ticks, etc.)
Source§impl<T: Clone, C: Clone + PixelColor> Clone for LinearAxis<T, C>
impl<T: Clone, C: Clone + PixelColor> Clone for LinearAxis<T, C>
Source§fn clone(&self) -> LinearAxis<T, C>
fn clone(&self) -> LinearAxis<T, C>
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 moreAuto Trait Implementations§
impl<T, C> Freeze for LinearAxis<T, C>
impl<T, C> RefUnwindSafe for LinearAxis<T, C>where
T: RefUnwindSafe,
C: RefUnwindSafe,
impl<T, C> Send for LinearAxis<T, C>
impl<T, C> Sync for LinearAxis<T, C>
impl<T, C> Unpin for LinearAxis<T, C>
impl<T, C> UnwindSafe for LinearAxis<T, C>where
T: UnwindSafe,
C: UnwindSafe,
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
Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Casts the value.
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Casts the value.
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> OverflowingAs for T
impl<T> OverflowingAs for T
Source§fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
Source§fn overflowing_cast_from(src: Src) -> (Dst, bool)
fn overflowing_cast_from(src: Src) -> (Dst, bool)
Casts the value.
Source§impl<T> SaturatingAs for T
impl<T> SaturatingAs for T
Source§fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
Source§fn saturating_cast_from(src: Src) -> Dst
fn saturating_cast_from(src: Src) -> Dst
Casts the value.
Source§impl<T> UnwrappedAs for T
impl<T> UnwrappedAs for T
Source§fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
Casts the value.
Source§impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
Source§fn unwrapped_cast_from(src: Src) -> Dst
fn unwrapped_cast_from(src: Src) -> Dst
Casts the value.
Source§impl<T> WrappingAs for T
impl<T> WrappingAs for T
Source§fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
Source§fn wrapping_cast_from(src: Src) -> Dst
fn wrapping_cast_from(src: Src) -> Dst
Casts the value.