Produce "nice" intervals for e.g. axis labels.
** What are "nice" numbers/integers/datetimes? **
When I say "nice", I just mean that I try to calculate intervals which begin with 10, 5, 3, 2, 1 (adjusted to magnitude, of course!). For dates, I try to hit whole days, weeks, months or hours, minutes, and seconds.
Will get you around the amount of numbers you pass it, although it will prioritize getting "nice" numbers.
Will get you closer to the amount of numbers you pass it, although not actually exactly, since you still want decently "nice" numbers.
P.S. If you have a better name for this function, please contact me.
The upper and lower bound of your numbers/timestamps.
Makes evenly spaced floats.
Arguments:
Intervals.custom 45 10 (Range 25 100)
-- ^ Makes [ 25, 35, 45, 55, 65, 75, 85, 95 ]
Intervals.custom 30 20 (Range 25 100)
-- ^ Makes [ 30, 50, 70, 90 ]Produce a list of "nice" dates.
Arguments:
The timezone which the chart is being shown in.
The maximum amount of times you'd like to have produced.
The beginning timestamp (as a float for chart convenience)
The ending timestamp (as a float for chart convenience)
A timestamp with extra info helpful for formatting. Explanation:
Just when the tick is changing to a larger unit
than used in the interval. E.g. if the interval is 2 hours, then
this will be a Just Day when the day changes. Useful if you
want a different formatting for those ticks!You can format your tick label differently based on it's unit.
Produce a list of "nice" integers.