Gantt charts: axis formats (date / duration)

Gantt charts: axis formats (date / duration)

puml.online

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
2
3
4
5
6
7
8
9
10
@startgantt
Project starts 2026-01-05
[Requirements] lasts 5 days
[Prototype] lasts 10 days
[Detailed design] lasts 2 weeks
[Implementation] lasts 3 weeks
[System testing] lasts 8 days
[Milestone: code freeze] happens on 2026-03-16
[Release] lasts 3 days
@endgantt

Key points:

  • Project starts 2026-01-05 sets the origin of the whole time axis.
  • lasts 5 days / lasts 2 weeks / lasts 3 weeks set task durations and, indirectly, the tick scale.
  • happens on 2026-03-16 is a zero-length task — that is how you draw a milestone.
  • To anchor a task to an explicit date, replace lasts with starts 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
2
3
4
5
6
7
8
9
10
11
12
13
14
gantt
title Gantt chart: axis formats
dateFormat YYYY-MM-DD
axisFormat %Y-%m-%d
section Planning
Requirements :done, req, 2026-01-05, 5d
Prototype :active, proto, 2026-01-10, 10d
section Design
Detailed design :design, 2026-01-20, 2w
Implementation :dev, 2026-02-03, 3w
section Delivery
System testing :test, 2026-02-24, 8d
Code freeze :milestone, m1, 2026-03-04, 0d
Release :rel, 2026-03-05, 3d

Key points:

  • dateFormat YYYY-MM-DD must match the date strings in your tasks, otherwise parsing fails.
  • axisFormat %Y-%m-%d is the tick label template: %Y year, %m month, %d day, %b abbreviated month name.
  • The trailing 5d / 2w are duration units (d days, w weeks, h hours). Without a start date they mean “offset from the previous task”.
  • :milestone is 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.
On this page
Gantt charts: axis formats (date / duration)