#[non_exhaustive]pub struct TickLabels<XY: Tick> {
pub min_chars: RwSignal<usize>,
pub format: RwSignal<Arc<dyn Fn(&XY, &dyn Format<Tick = XY>) -> String + Send + Sync>>,
pub generator: RwSignal<Arc<dyn TickGen<Tick = XY> + Send + Sync>>,
}Expand description
Builds tick labels for an axis.
Note that ticks lack an identity resulting in generators and labels not being reactive.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.min_chars: RwSignal<usize>Minimum number of characters to display for each tick label.
Helpful for giving a fixed width to labels e.g., if your graph can display 0-100 then it might show a shorter label on “0” or “42” to “100”. Needed to have the same inner chart ratio when using an outer chart ratio. Can also be useful for aligning a list of charts.
format: RwSignal<Arc<dyn Fn(&XY, &dyn Format<Tick = XY>) -> String + Send + Sync>>Format function for the tick labels. See TickLabels::with_format for details.
generator: RwSignal<Arc<dyn TickGen<Tick = XY> + Send + Sync>>Tick generator for the labels.
Implementations§
Source§impl TickLabels<f64>
impl TickLabels<f64>
Sourcepub fn aligned_floats() -> Self
pub fn aligned_floats() -> Self
Creates a new tick label generator for floating point numbers. See AlignedFloats for details.
Source§impl<Tz> TickLabels<DateTime<Tz>>
impl<Tz> TickLabels<DateTime<Tz>>
Sourcepub fn timestamps() -> Self
pub fn timestamps() -> Self
Creates a new tick label generator for timestamps. See Timestamps for details.
Source§impl<XY: Tick> TickLabels<XY>
impl<XY: Tick> TickLabels<XY>
Sourcepub fn from_generator(gen: impl TickGen<Tick = XY> + 'static) -> Self
pub fn from_generator(gen: impl TickGen<Tick = XY> + 'static) -> Self
Creates a new tick label generator from a tick generator. Use AlignedFloats or Timestamps for available generators.
Sourcepub fn with_min_chars(self, min_chars: usize) -> Self
pub fn with_min_chars(self, min_chars: usize) -> Self
Sets the minimum number of characters to display for each tick label.
Sourcepub fn with_format(
self,
format: impl Fn(&XY, &dyn TickFormat<Tick = XY>) -> String + Send + Sync + 'static,
) -> Self
pub fn with_format( self, format: impl Fn(&XY, &dyn TickFormat<Tick = XY>) -> String + Send + Sync + 'static, ) -> Self
Sets the format function for the tick labels.
This is a function that takes a Tick and a formatter and returns a String. It gives an opportunity to customise tick label format. The formatter is the resulting state of the tick generator and does the default aciton. For example if aligned floats decides to use “1000s” then the formatter will use that.
Trait Implementations§
Source§impl<XY: Tick> Clone for TickLabels<XY>
impl<XY: Tick> Clone for TickLabels<XY>
Source§impl<XY: Tick> Default for TickLabels<XY>
impl<XY: Tick> Default for TickLabels<XY>
Source§impl<Gen, XY> From<Gen> for TickLabels<XY>where
Gen: TickGen<Tick = XY> + 'static,
XY: Tick,
impl<Gen, XY> From<Gen> for TickLabels<XY>where
Gen: TickGen<Tick = XY> + 'static,
XY: Tick,
Source§impl<XY: Tick> From<TickLabels<XY>> for EdgeLayout<XY>
impl<XY: Tick> From<TickLabels<XY>> for EdgeLayout<XY>
Source§fn from(inner: TickLabels<XY>) -> Self
fn from(inner: TickLabels<XY>) -> Self
Source§impl<XY: Tick> From<TickLabels<XY>> for Vec<EdgeLayout<XY>>
impl<XY: Tick> From<TickLabels<XY>> for Vec<EdgeLayout<XY>>
Source§fn from(inner: TickLabels<XY>) -> Self
fn from(inner: TickLabels<XY>) -> Self
Source§impl<XY: Tick> IntoEdge<XY> for TickLabels<XY>
impl<XY: Tick> IntoEdge<XY> for TickLabels<XY>
Source§fn into_edge(self) -> EdgeLayout<XY>
fn into_edge(self) -> EdgeLayout<XY>
Source§impl<XY: PartialEq + Tick> PartialEq for TickLabels<XY>
impl<XY: PartialEq + Tick> PartialEq for TickLabels<XY>
Source§fn eq(&self, other: &TickLabels<XY>) -> bool
fn eq(&self, other: &TickLabels<XY>) -> bool
self and other values to be equal, and is used by ==.impl<XY: PartialEq + Tick> StructuralPartialEq for TickLabels<XY>
Auto Trait Implementations§
impl<XY> Freeze for TickLabels<XY>
impl<XY> RefUnwindSafe for TickLabels<XY>
impl<XY> Send for TickLabels<XY>
impl<XY> Sync for TickLabels<XY>
impl<XY> Unpin for TickLabels<XY>
impl<XY> UnsafeUnpin for TickLabels<XY>
impl<XY> UnwindSafe for TickLabels<XY>
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<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