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
'minute' | 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'year' | string
required
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
required
Number of units per cell. For example,
{ unit: "month", step: 2 } creates one cell
every two months.string | (date: Date, next?: Date) => string
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:
(date: Date) => string
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.