pub enum LabelStrategy {
Horizontal,
Rotated {
margin: f64,
skip_factor: Option<usize>,
},
Truncated {
max_width: f64,
},
Sampled {
indices: Vec<usize>,
},
}Expand description
The strategy selected for rendering labels.
Variants§
Horizontal
Labels displayed horizontally (no transformation needed).
Rotated
Labels rotated -45 degrees. Contains the additional bottom margin needed and an optional skip factor for label sampling after rotation.
Truncated
Labels truncated to max_width with ellipsis.
Sampled
Only a subset of labels shown (evenly sampled).
Implementations§
Source§impl LabelStrategy
impl LabelStrategy
Sourcepub fn determine(
labels: &[String],
available_width: f64,
config: &LabelStrategyConfig,
) -> Self
pub fn determine( labels: &[String], available_width: f64, config: &LabelStrategyConfig, ) -> Self
Determine the best label strategy based on available space and label measurements.
Algorithm (cascading priority):
- Horizontal: if labels fit without overlap
- Rotated: if <= 40 labels, rotate -45 degrees (post-rotation truncation is applied later in generate_x_axis to guarantee no overlap)
- Truncated: if truncated labels fit and <= 50 labels
- Sampled: show an evenly-distributed subset
Parameters:
- labels: the label strings
- available_width: total width available for the axis (chart width)
- config: strategy configuration
Trait Implementations§
Source§impl Clone for LabelStrategy
impl Clone for LabelStrategy
Source§fn clone(&self) -> LabelStrategy
fn clone(&self) -> LabelStrategy
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 moreSource§impl Debug for LabelStrategy
impl Debug for LabelStrategy
Source§impl PartialEq for LabelStrategy
impl PartialEq for LabelStrategy
impl StructuralPartialEq for LabelStrategy
Auto Trait Implementations§
impl Freeze for LabelStrategy
impl RefUnwindSafe for LabelStrategy
impl Send for LabelStrategy
impl Sync for LabelStrategy
impl Unpin for LabelStrategy
impl UnsafeUnpin for LabelStrategy
impl UnwindSafe for LabelStrategy
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