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
Computes settings to display values.
Finds the area where a data-set is defined, as to properly place minimums and maximums.
Rescales a value from domain to range.
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 SourceComputes 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}
Formats ticks.
(can be refactored in Lin)
Link to this function
rescale_value(v, domain_min, domain_width, range_min, range_width)
View SourceRescales a value from domain to range.
Expects
(can be refactored in Lin)
Makes sure that a range of numerics is a tuple of floats, in the right order.
Validates a range, that could be nil.