Expand description
Where an axis’s ticks fall: on nice numbers, 1, 2 or 5 times a power of ten, or
on calendar boundaries such as hours, days, months and years. Pure arithmetic;
crate::widgets::axes decides how many fit and draws them.
Structs§
- Calendar
Step - Every
nof a unit. Each step divides the unit above it, so a new day, month or year always lands on a tick.
Enums§
- Unit
- A calendar unit a time axis ticks on.
Functions§
- calendar_
labels - Labels for ticks on
unitboundaries, each naming the coarsest unit that turns there:2026at a new year,Aprat a new month,Mar 5at a new day among hours, otherwise the tick in its own unit (12,06:00). Withcontextthe first tick also names the year (and the day, for hours) the axis starts in. A time of day reads as a clock. - calendar_
steps - The calendar steps a
kindaxis can take, finest first: a date ticks on days at the finest, a time of day on hours at the coarsest. - calendar_
ticks - The ticks of
stepfromlotohi, on its boundaries; none when there would be too many to consider. - from_
datetime - The axis value a date and time stands at, the inverse of
to_datetime. - minor_
steps - A finer step that ticks between those of
step, 1-2-5 as well: tenths of a 1-step, fifths, halves; halves or quarters of a 2-step; fifths of a 5-step. Finest first. - multiples
- The multiples of
stepfromlotohi. - nice_
steps - The 1-2-5 steps for an axis from
lotohi, finest first: from the finest no finer thanfinestto the first that spans the whole axis. 25, 250 and so on step between 20 and 50 where they need no more places than their neighbors. Awholeaxis steps by whole numbers only. - to_
datetime - An axis value as the date and time it stands for; a time of day falls on the epoch’s day.
- widen
lotohiwidened out to multiples ofstep, never to nothing.- widen_
snug widen, except that an end a whole tick would leave more than three quarters of a step empty stops at the coarsest minor tick past the data instead. A mean a hair under zero widened a step-10 axis down to -10, a fifth of the plot holding nothing.