pub struct AxisHints<'a> { /* private fields */ }Expand description
Axis configuration.
Used to configure axis label and ticks.
Implementations§
Source§impl<'a> AxisHints<'a>
impl<'a> AxisHints<'a>
Sourcepub fn new(axis: Axis) -> Self
pub fn new(axis: Axis) -> Self
Initializes a default axis configuration for the specified axis.
label is empty.
formatter is default float to string formatter.
Sourcepub fn formatter(
self,
fmt: impl Fn(GridMark, &RangeInclusive<f64>) -> String + 'a,
) -> Self
pub fn formatter( self, fmt: impl Fn(GridMark, &RangeInclusive<f64>) -> String + 'a, ) -> Self
Specify custom formatter for ticks.
The first parameter of formatter is the raw tick value as f64.
The second parameter of formatter is the currently shown range on this axis.
Sourcepub fn label(self, label: impl Into<WidgetText>) -> Self
pub fn label(self, label: impl Into<WidgetText>) -> Self
Specify axis label.
The default is ‘x’ for x-axes and ‘y’ for y-axes.
Sourcepub fn min_thickness(self, min_thickness: f32) -> Self
pub fn min_thickness(self, min_thickness: f32) -> Self
Specify minimum thickness of the axis
Sourcepub fn max_digits(self, digits: usize) -> Self
👎Deprecated: Use min_thickness instead
pub fn max_digits(self, digits: usize) -> Self
min_thickness insteadSpecify maximum number of digits for ticks.
Sourcepub fn placement(self, placement: impl Into<Placement>) -> Self
pub fn placement(self, placement: impl Into<Placement>) -> Self
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>) -> Self
pub fn label_spacing(self, range: impl Into<Rangef>) -> Self
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.