Skip to main content

generate_ticks

Function generate_ticks 

Source
pub fn generate_ticks(
    data_min: f64,
    data_max: f64,
    target_count: usize,
    scale: &Scale,
) -> Vec<Tick>
Expand description

Generates optimal tick positions for an axis range.

Uses the Talbot/Wilkinson extended algorithm to find “nice” tick values that balance simplicity, coverage, density, and legibility.

§Arguments

  • data_min / data_max: the data range
  • target_count: desired number of ticks (typically 5-10)
  • scale: the axis scale (Linear, Log10, etc.)

§Returns

A Vec<Tick> with positions and formatted labels.