Skip to content

Mermaid Gantt charts

Mermaid Gantt charts are a diagram type supported by the [[Mermaid]] syntax, useful for illustrating project schedules and timelines.^[600-developer__tools__obsidian__Johnny-OB-037.md]

Syntax Structure

The diagram definition begins with the gantt keyword.^[600-developer__tools__obsidian__Johnny-OB-037.md] Tasks are organized into named section blocks to group related activities.^[600-developer__tools__obsidian__Johnny-OB-037.md]

Task Declaration

Tasks are defined using a specific line format that includes the task name, a unique identifier, and time parameters.^[600-developer__tools__obsidian__Johnny-OB-037.md] The general syntax is:

TaskName :state, id, startDate, duration

Where: * TaskName: The text label displayed on the chart. * state: The status of the task (e.g., done, active). * id: A unique descriptor for the task. * startDate: The beginning date of the task. * duration: How long the task takes (e.g., 3d for 3 days).

Task States

Different states can be applied to tasks to visually distinguish their status. Common states include done for completed tasks and active for tasks currently in progress.^[600-developer__tools__obsidian__Johnny-OB-037.md]

Dependencies

Tasks can be scheduled in relation to one another using the after keyword followed by a task ID.^[600-developer__tools__obsidian__Johnny-OB-037.md] For example, specifying after des1 ensures the new task starts only after the task with the ID des1 is scheduled to end, allowing for the creation of parallel or sequential workflows.

Example

The following code generates a chart with completed and active tasks, including parallel sequences:^[600-developer__tools__obsidian__Johnny-OB-037.md]

gantt
section Section
Completed :done,    des1, 2014-01-06,2014-01-08
Active        :active,  des2, 2014-01-07, 3d
Parallel 1   :         des3, after des1, 1d
Parallel 2   :         des4, after des1, 1d
Parallel 3   :         des5, after des3, 1d
Parallel 4   :         des6, after des4, 1d

Sources

^[600-developer__tools__obsidian__Johnny-OB-037.md]