5.3.1 What Is a Gantt Chart?
A Gantt chart is a time-based visualization used for:
Unlike:
Flowcharts → show process flow
State diagrams → show lifecycle states
Gantt charts focus on time and duration.
In Mermaid, every Gantt chart begins with:
5.3.2 Basic Gantt Structure
Minimum structure:
Key components:
dateFormat → required for parsing dates
section → logical grouping
start date, duration → schedule definition
The dateFormat directive is mandatory.
Example:
Common formats:
Choose one and remain consistent.
5.3.4 Defining Tasks
Task syntax:
Example:
3d = 3 days
You can also use:
5.3.5 Multiple Sections
Sections group related tasks.
Example:
Sections improve readability in complex plans.
5.3.6 Task Dependencies
You can make a task start after another finishes.
Syntax:
Example:
Here:
“Run Tests” begins after “Compile Code” completes.
Dependencies help model realistic scheduling.
5.3.7 Using IDs for Tasks
For clarity and reuse:
Example:
IDs are helpful for complex dependencies.
5.3.8 Milestones
Milestones represent key events with zero duration.
Syntax:
Example:
Milestones visually mark:
5.3.9 Marking Task Status
Mermaid allows marking tasks as:
Example:
This helps communicate project health.
5.3.10 Full Example — SaaS Product Roadmap
This represents:
5.3.11 Managing Long Projects
For multi-month projects:
Break large tasks into phases
Use milestones strategically
Avoid cluttering with too many micro-tasks.
5.3.12 Common Mistakes
Using inconsistent date format
Creating circular dependencies
Mixing time units inconsistently
Incorrect:
Choose one date format and stick to it.
5.3.13 Refactoring Example (Hands-On)
Start simple:
Now improve with dependency and milestone:
Notice:
Timeline clarity improved
5.3.14 Hands-On Exercise
Design a Mobile App Launch Timeline:
Sections:
Requirements:
At least one critical task
Use consistent date format
Focus on clarity, not micro-detail.
5.3.15 Best Practices
Use dependencies for realism
Avoid unnecessary complexity
Maintain consistent date formatting
Highlight only truly critical tasks
Gantt charts should communicate schedule at a glance.
5.3.16 Key Takeaways
Gantt chart structure in Mermaid includes:
Gantt charts are ideal for:
Product development timelines
With this, you now understand:
State diagrams for lifecycle modeling
Gantt charts for time-based planning
In the next chapter, we will move into Advanced Usage and Integration, where we explore theming, embedding, and automation techniques in Mermaid.