Skip to content

VIEW_MODE_PRESETS

const VIEW_MODE_PRESETS: readonly ViewMode[]

Defined in: core/src/scale/view-modes.ts:220

The built-in view modes, deeply frozen, from the finest to the coarsest:

id column pxPerDay headers majorLine minorLine snap padding
hour 1 h 960 day / hour (00–23) day 15min 15min 7d
quarter-day 6 h 160 day / 6 h (00, 06, 12, 18) day 1h 1h 7d
half-day 12 h 80 day / 12 h (00, 12) day 1h 1h 14d
day 1 d 40 month / day week — 1d 14d
week 1 w 20 month / week range month — 1d 4w
month 1 mo 4 year / month quarter — 1d 4mo
year 1 y 1 decade / year — — 1mo 2y

pxPerDay is chosen so that a column is readable; hour uses 960 instead of 240, which gives 40 px hour columns like the 40 px day columns of day (at 240 the hour labels do not fit and the 15-minute minor lines, 2.5 px apart, never show). Snap defaults are raised to scheduling.granularity when finer. Labels are English; override label to translate them.

The columns of the three hourly presets are all 40 px wide, so their hour row shows the hour as two digits of the 24-hour clock in every locale ("17", never "5 PM" or "17 Uhr", which do not fit). To show a locale’s own clock, replace the row and give the columns the room it needs, e.g. { 'quarter-day': { pxPerDay: 280, headers: [{ unit: 'day', format: { day: 'numeric' } }, { unit: 'hour', step: 6, format: { hour: 'numeric' } }] } } (70 px per column).