Gantt charts: axis formats (date / duration)
Introduction
A Gantt chart’s horizontal axis is a time axis, so how the dates are parsed and how the ticks are labelled decides whether the chart reads well. PlantUML has no dedicated axis-format directive — the tick granularity is derived from task start dates and duration units. Mermaid, by contrast, exposes two explicit declarations, dateFormat and axisFormat. This post writes the same “discovery → design → build → release” schedule in both engines and compares the results.
PlantUML version
PlantUML gantt charts have no axisFormat-style declaration. Tick granularity is inferred from the dates and durations you write: short spans render day ticks, longer spans roll up to weeks or months. What you control is the date spelling and the duration unit — dates as YYYY-MM-DD, durations as readable units like days / weeks / months, and the engine picks the tick scale from those.
1 | @startgantt |
Key points:
Project starts 2026-01-05sets the origin of the whole time axis.lasts 5 days/lasts 2 weeks/lasts 3 weeksset task durations and, indirectly, the tick scale.happens on 2026-03-16is a zero-length task — that is how you draw a milestone.- To anchor a task to an explicit date, replace
lastswithstarts 2026-01-12 and lasts 4 days.
Mermaid version
Mermaid splits “how dates are parsed” from “how ticks are labelled”. dateFormat tells the engine how to read the date strings in your tasks; axisFormat decides how the axis labels are rendered. Both use moment-style separator syntax.
1 | gantt |
Key points:
dateFormat YYYY-MM-DDmust match the date strings in your tasks, otherwise parsing fails.axisFormat %Y-%m-%dis the tick label template:%Yyear,%mmonth,%dday,%babbreviated month name.- The trailing
5d/2ware duration units (ddays,wweeks,hhours). Without a start date they mean “offset from the previous task”. :milestoneis a task state marker that renders the diamond milestone shape.
Side-by-side
| Aspect | PlantUML | Mermaid |
|---|---|---|
| Date format declaration | No dedicated directive; parsed from YYYY-MM-DD literals |
Explicit dateFormat YYYY-MM-DD |
| Axis tick format | No axisFormat; granularity derived from date span |
Explicit axisFormat %Y-%m-%d label template |
| Duration spelling | lasts 5 days / lasts 2 weeks (natural-language units) |
5d / 2w / 3h (compact units) |
| Milestones | happens on 2026-03-16 zero-length task |
:milestone state marker + 0d duration |
| Grouping | No section concept; prefix task names yourself | Explicit section Planning |
| Task states | No state markers | :done / :active / :crit markers |
Wrap-up
If you need precise control over what the tick labels look like, Mermaid’s dateFormat + axisFormat pair is the more direct tool. PlantUML hands formatting control back to the way you spell dates and durations, so there is no second format string to maintain. The biggest gap between the two is duration syntax — lasts 2 weeks and 2w mean the same thing — so pick one style and keep it consistent across the diagram.
- Title: Gantt charts: axis formats (date / duration)
- Author: puml.online
- Created at : 2026-11-14 09:00:00
- Updated at : 2026-11-26 01:07:01
- Link: https://puml.online/blog/gantt-axis-formats-en/
- License: This work is licensed under CC BY-NC-SA 4.0.