View Source Contex.ScaleUtils (ContEx v0.5.0)

Here are common functions that can be shared between multiple scales.

Link to this section Summary

Functions

Finds the area where a data-set is defined, as to properly place minimums and maximums.

Makes sure that a range of numerics is a tuple of floats, in the right order.

Validates a range, that could be nil.

Link to this section Functions

Link to this function

compute_nice_settings(min_d, max_d, explicit_ticks, interval_count)

View Source

Computes settings to display values.

%{
  nice_domain: {min_nice, max_nice},
  interval_size: rounded_interval_size,
  interval_count: adjusted_interval_count,
  display_decimals: display_decimals
}

(can be refactored in Lin)

Finds the area where a data-set is defined, as to properly place minimums and maximums.

Returns a domain, e.g. {-3, 22}

Link to this function

format_tick_text(tick, display_decimals, custom_tick_formatter)

View Source

Formats ticks.

(can be refactored in Lin)

Link to this function

rescale_value(v, domain_min, domain_width, range_min, range_width)

View Source

Rescales a value from domain to range.

Expects

(can be refactored in Lin)

Link to this function

validate_option(o, option_name, possible_options)

View Source
Link to this function

validate_range(v, label)

View Source

Makes sure that a range of numerics is a tuple of floats, in the right order.

Link to this function

validate_range_nil(r, label)

View Source

Validates a range, that could be nil.