scales prop defines the rows of time headers displayed above the chart. Each entry
in the array describes one header row, with the rows rendered top-to-bottom in the order
you provide them.
Basic example
The most common configuration is a two-row scale showing months above and days below:Multi-row scale
You can stack as many rows as needed. The following four-row configuration is taken directly from thecomplexScales demo dataset:
Hour-level scale
For intraday scheduling, usehour as the smallest unit:
IScaleConfig fields
The time unit for this scale row. The smallest unit across all rows determines the
base cell size (
cellWidth). Custom units can be registered with registerScaleUnit.Number of units per cell. For example,
{ unit: "month", step: 2 } creates one cell
every two months.Format string or function controlling the label inside each cell.Format string tokens:
Function format receives the cell start date and the next cell start date, giving
you full control:
| Token | Output |
|---|---|
%Y | 4-digit year (e.g. 2026) |
%F | Full month name (e.g. April) |
%M | Short month name (e.g. Apr) |
%j | Day of month without leading zero |
%d | Day of month with leading zero |
%H | Hour (24-hour, with leading zero) |
%i | Minutes with leading zero |
%w | Week number |
%W | Week number (alternative) |
%Q | Quarter label (e.g. Q1) |
Function that returns a CSS class name for a given cell date. Useful for highlighting
weekends or other special days:
Custom scale units
If the built-in units do not meet your needs, register a custom unit withregisterScaleUnit. A custom unit must implement the GanttScaleUnit interface:
The
smallerCount and biggerCount maps inform the zoom logic how many of this
unit fit into larger units and vice versa. Providing them ensures correct cell-width
calculations when zooming.