Expand description
Calendar heatmap layout (stat_calendar / GGPlot::geom_calendar): a date
column becomes week-column × weekday-row tiles.
Structs§
- Calendar
Grid - The calendar grid shared by
StatCalendarandgeom_calendar: which day is column 0 / row 0, and the (clipped) first/last day. - Stat
Calendar - Lays a date
xout as calendar cells:x= week column,y= weekday row (first weekday on top, y = 6 … 0), unitxmin/xmax/ymin/ymaxextents, and the ISO date inDATE_KEY_COL. Other columns (fill,label, …) pass through. Dates older thanMAX_CALENDAR_YEARSbefore the newest are dropped.
Constants§
- DATE_
KEY_ COL - Column holding each cell’s ISO date (
YYYY-MM-DD);geom_tileuses it as the hover key (data-xand tooltip) instead of the week/weekday position. - MAX_
CALENDAR_ YEARS - Longest span laid out, in years. Older dates are clipped (with a build
warning from
geom_calendar) so a stray 1900-01-01 cannot blow up the layout or allocate thousands of month boundaries.
Functions§
- civil_
from_ days - Civil
(year, month, day)of a day number (Hinnant). - day_
number - Days since 1970-01-01 for a date value:
DateTime(epoch seconds), a number (epoch seconds, asDateTimecoerces), or an ISOYYYY-MM-DD…string.Nonefor anything else / out of range. - days_
from_ civil - Days since 1970-01-01 of a civil date (Hinnant).
- month_
boundaries - Month boundary segments
(x, y, xend, yend)separating consecutive months (GitHub/ECharts style step outlines), in calendar coordinates. - month_
breaks - Month-start x breaks/labels for a calendar grid: the week column of each month’s first day. Over two years, only Januaries are labelled (with the year); a multi-year range adds the year to each January.
- weekday
- Weekday of a day number, 0-based from the week start (Sunday or Monday).