IScaleConfig type defines a single row in the Gantt chart’s time header. You can stack multiple scale rows to create multi-level headers (for example, months on top and days below).
TypeScript definition
Fields
The time unit for this scale row. Controls how wide each cell is relative to
cellWidth.Accepted values:"minute"— one cell per minute"hour"— one cell per hour"day"— one cell per day"week"— one cell per week"month"— one cell per month"quarter"— one cell per quarter (3 months)"year"— one cell per year- A custom string registered via
registerScaleUnit()
Number of units per cell. For example,
unit: "day", step: 7 produces one cell per 7 days (same width as a week cell but with different rendering).Controls the label displayed in each scale cell.
- String: A date-fns format string, e.g.
"MMM d","yyyy","HH:mm". - Function: A custom formatter receiving the cell’s start
dateand optionally the next cell’sdate. Return a string.
Function returning a CSS class string for a given cell’s start date. Use this to highlight weekends, months, or other intervals.
TLengthUnit values
| Unit | Cell represents |
|---|---|
minute | 1 minute |
hour | 1 hour |
day | 1 calendar day |
week | 1 calendar week |
month | 1 calendar month |
quarter | 3 months |
year | 1 calendar year |
Format string examples
Theformat field accepts date-fns format strings:
| Format string | Example output |
|---|---|
"d" | 5 |
"MMM d" | Mar 5 |
"MMMM yyyy" | March 2024 |
"QQQ yyyy" | Q1 2024 |
"yyyy" | 2024 |
"HH:mm" | 09:30 |
"EEE, MMM d" | Tue, Mar 5 |
Examples
- Day / month
- Hour / day
- Quarter / month
- Custom CSS
- Function format