Struct egui_plot::AxisHints

source ·
pub struct AxisHints { /* private fields */ }
Expand description

Axis configuration.

Used to configure axis label and ticks.

Implementations§

source§

impl AxisHints

source

pub fn new_x() -> Self

Initializes a default axis configuration for the X axis.

source

pub fn new_y() -> Self

Initializes a default axis configuration for the X axis.

source

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. maximum digits on tick label is 5.

source

pub fn formatter( self, fmt: impl Fn(GridMark, usize, &RangeInclusive<f64>) -> String + 'static ) -> Self

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.

source

pub fn label(self, label: impl Into<WidgetText>) -> Self

Specify axis label.

The default is ‘x’ for x-axes and ‘y’ for y-axes.

source

pub fn max_digits(self, digits: usize) -> Self

Specify maximum number of digits for ticks.

This is considered by the default tick formatter and affects the width of the y-axis

source

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.

source

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.

Trait Implementations§

source§

impl Clone for AxisHints

source§

fn clone(&self) -> AxisHints

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.