pub struct AxisHints { /* private fields */ }Expand description
Axis configuration.
Used to configure axis label and ticks.
Implementations§
Source§impl AxisHints
impl AxisHints
Sourcepub fn new(axis: Axis) -> AxisHints
pub fn new(axis: Axis) -> AxisHints
Initializes a default axis configuration for the specified axis.
label is empty.
formatter is default float to string formatter.
maximum digits on tick label is 5.
Sourcepub fn formatter(
self,
fmt: impl Fn(GridMark, usize, &RangeInclusive<f64>) -> String + 'static,
) -> AxisHints
pub fn formatter( self, fmt: impl Fn(GridMark, usize, &RangeInclusive<f64>) -> String + 'static, ) -> AxisHints
Specify custom formatter for ticks.
The first parameter of formatter is the raw tick value as f64.
The second parameter is the maximum number of characters that fit into y-labels.
The second parameter of formatter is the currently shown range on this axis.
Sourcepub fn label(self, label: impl Into<WidgetText>) -> AxisHints
pub fn label(self, label: impl Into<WidgetText>) -> AxisHints
Specify axis label.
The default is ‘x’ for x-axes and ‘y’ for y-axes.
Sourcepub fn max_digits(self, digits: usize) -> AxisHints
pub fn max_digits(self, digits: usize) -> AxisHints
Specify maximum number of digits for ticks.
This is considered by the default tick formatter and affects the width of the y-axis
Sourcepub fn placement(self, placement: impl Into<Placement>) -> AxisHints
pub fn placement(self, placement: impl Into<Placement>) -> AxisHints
Specify the placement of the axis.
For X-axis, use VPlacement.
For Y-axis, use HPlacement.
Sourcepub fn label_spacing(self, range: impl Into<Rangef>) -> AxisHints
pub fn label_spacing(self, range: impl Into<Rangef>) -> AxisHints
Set the minimum spacing between labels
When labels get closer together than the given minimum, then they become invisible. When they get further apart than the max, they are at full opacity.
Labels can never be closer together than the crate::Plot::grid_spacing setting.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AxisHints
impl !RefUnwindSafe for AxisHints
impl !Send for AxisHints
impl !Sync for AxisHints
impl Unpin for AxisHints
impl !UnwindSafe for AxisHints
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more