fn calculate_tick_step_for_range(min: f64, max: f64, max_ticks: usize) -> f64 {
    let range = max - min;
    let min_tick_step = range / max_ticks as f64;
    // Get the first entry which is our smallest possible tick step size
    let smallest_valid_step = TickSteps::start_at(min_tick_step)
        .find(|&s| number_of_ticks(min, max, s) <= max_ticks)
        .expect("ERROR: We've somehow run out of tick step options!");
    // Count how many ticks that relates to
    let actual_num_ticks = number_of_ticks(min, max, smallest_valid_step);

    // Create a new TickStep iterator, starting at the correct lower bound
    let tick_steps = TickSteps::start_at(smallest_valid_step);
    // Get all the possible tick step sizes that give just as many ticks
    let step_options = tick_steps.take_while(|&s| number_of_ticks(min, max, s) == actual_num_ticks);
    // Get the largest tick step size from the list
    step_options.fold(-1. / 0., f64::max)
}
/// Given a range of values, and a maximum number of ticks, calulate the step between the ticks
Given a range of values, and a maximum number of ticks, calulate the step between the ticks
Given a range of values and a maximum number of ticks calulate the step between the ticks
fn calculate_tick_step_for_range(min: f64, max: f64, max_ticks: usize) -> f64 {
    let range = max - min;
    let min_tick_step = range / max_ticks as f64;
    // Get the first entry which is our smallest possible tick step size
    let smallest_valid_step = TickSteps::start_at(min_tick_step)
        .find(|&s| number_of_ticks(min, max, s) <= max_ticks)
        .expect("ERROR: We've somehow run out of tick step options!");
    // Count how many ticks that relates to
    let actual_num_ticks = number_of_ticks(min, max, smallest_valid_step);
    // Create a new TickStep iterator, starting at the correct lower bound
    let tick_steps = TickSteps::start_at(smallest_valid_step);
    // Get all the possible tick step sizes that give just as many ticks
    let step_options = tick_steps.take_while(|&s| number_of_ticks(min, max, s) == actual_num_ticks);
    // Get the largest tick step size from the list
    step_options.fold(-1. / 0., f64::max)
}
fn calculate_tick_step_for_range ( min : f64 , max : f64 , max_ticks : usize ) -> f64 { let range = max - min ; let min_tick_step = range / max_ticks as f64 ; // Get the first entry which is our smallest possible tick step size let smallest_valid_step = TickSteps :: start_at ( min_tick_step ) . find ( | & s | number_of_ticks ( min , max , s ) <= max_ticks ) . expect ( " " ) ; // Count how many ticks that relates to let actual_num_ticks = number_of_ticks ( min , max , smallest_valid_step ) ; // Create a new TickStep iterator, starting at the correct lower bound let tick_steps = TickSteps :: start_at ( smallest_valid_step ) ; // Get all the possible tick step sizes that give just as many ticks let step_options = tick_steps . take_while ( | & s | number_of_ticks ( min , max , s ) == actual_num_ticks ) ; // Get the largest tick step size from the list step_options . fold ( - 1. / 0. , f64 :: max ) }
Given a range of values, and a maximum number of ticks, calulate the step between the ticks
Given a range of values and a maximum number of ticks calulate the step between the ticks
min
f64
max
f64
max_ticks
usize
min
f64
max
f64
max_ticks
usize