Building PERT Charts in PlantUML: A Code-Driven Guide to Project Scheduling

VPasCode PlantUML interface showing project timeline diagram with code editor.

Project Management is often about visualizing complexity. When you need to map out the critical path of a project, manage dependencies, and calculate early start/finish times, a PERT (Program Evaluation and Review Technique) chart is the industry standard. While many tools exist, VPasCode offers a unique, code-driven approach using PlantUML to generate these diagrams programmatically.

This tutorial will guide you through the system architecture of creating a PERT chart using PlantUML syntax within VPasCode. We will dissect the “Website Redesign” example to understand how to structure tasks, embed metadata, and visualize dependencies.

1. Understanding the Architecture: Object Diagrams as PERT

One of the first things to realize is that PlantUML does not have a dedicated @startpert command. Instead, it leverages the flexibility of the Object Diagram syntax (@startuml). This allows developers to treat “Tasks” as “Objects” in the code, giving us the power to attach rich data (metadata) to them.

In this architecture, the diagram is built in three distinct phases:

  1. Definition: Creating nodes (Tasks) using the object keyword.
  2. Annotation: Embedding scheduling data (Duration, ES, EF) inside the object braces.
  3. Connection: Defining the flow and dependencies using arrows.

2. Syntax Rules: Defining the Nodes

To define a milestone or task, you use the object keyword followed by the task name and an alias for referencing. The alias is crucial for creating clean connections later.

object "Task 1: UX Research
& User Stories
[5 days]" as task1 {
  Early Start: Day 0
  Early Finish: Day 5
}

Key Syntax Breakdown:

  • object: The keyword to define a node.
  • "Task Name...": The visual label. Using 

    allows for line breaks to make the text readable.

  • as task1: The alias. This is the variable name used to link this task to others.
  • { ... }: The metadata container. This is where you define the logic for the PERT chart, such as Early Start and Early Finish.

3. Visual Styling with Skinparams

To make the chart professional and readable, we apply skinparam rules. This allows us to control the background color, border colors, and arrow thickness globally.

skinparam object {
    BackgroundColor LightYellow
    BorderColor DarkOrange
    ArrowColor Blue
    ArrowThickness 1.5
}

In this example, we use a LightYellow background for nodes to distinguish them from the white canvas, and DarkOrange borders to give them a distinct, professional look.

4. Establishing Direction and Dependencies

A PERT chart relies on flow. In PlantUML, we force a logical progression using the left to right direction directive. Without this, the chart might render vertically or unpredictably.

left to right direction

Dependencies are established using the --> operator. The syntax is [Start Node] --> [End Node] : [Label]. The label on the arrow helps clarify the nature of the dependency (e.g., “Approval required”).

task1 --> task2 : "User stories done"
task3 --> task4 : "Content ready"

5. Analyzing the Logic: The Critical Path

The true power of a PERT chart lies in analyzing the timing logic. Look at the intersection of Task 2 (Wireframing) and Task 3 (Content Audit) converging into Task 4 (Visual Design).

The Logic:

  • Task 2 finishes on Day 13.
  • Task 3 finishes on Day 6.

For Task 4 to begin, both dependencies must be satisfied. The system must wait for the longest path to complete. Therefore, even though Task 3 is ready early, Task 4 cannot start until Day 13. This is the essence of the Critical Path Method (CPM) visualized in code.

Complete Source Code

Below is the complete, executable PlantUML code for the Website Redesign Project. You can copy this directly into the VPasCode editor to generate the diagram.

@startuml
skinparam vpDiagramType PERTChart
left to right direction
title PERT Chart: Website Redesign Project

skinparam object {
    BackgroundColor LightYellow
    BorderColor DarkOrange
    ArrowColor Blue
    ArrowThickness 1.5
}

object "Project Kickoff" as start_node {
  Duration = 0 days
}

object "Task 1: UX Research\n& User Stories\n[5 days]" as task1 {
  Early Start: Day 0
  Early Finish: Day 5
}

object "Task 2: Wireframing\n& Prototyping\n[8 days]" as task2 {
  Early Start: Day 5
  Early Finish: Day 13
}

object "Task 3: Content Audit\n& Copywriting\n[6 days]" as task3 {
  Early Start: Day 0
  Early Finish: Day 6
}

object "Task 4: Visual Design\n(UI)\n[10 days]" as task4 {
  Early Start: Day 13
  Early Finish: Day 23
}

object "Task 5: Front-End\nDevelopment\n[12 days]" as task5 {
  Early Start: Day 23
  Early Finish: Day 35
}

object "Task 6: Back-End\nIntegration\n[8 days]" as task6 {
  Early Start: Day 23
  Early Finish: Day 31
}

object "Task 7: QA Testing\n& Bug Fixes\n[5 days]" as task7 {
  Early Start: Day 35
  Early Finish: Day 40
}

object "Task 8: UAT\n(User Acceptance)\n[3 days]" as task8 {
  Early Start: Day 40
  Early Finish: Day 43
}

object "Task 9: Deployment\n& Go-Live\n[2 days]" as task9 {
  Early Start: Day 43
  Early Finish: Day 45
}

object "Project Closure" as end_node {
  Duration = 0 days
}

start_node --> task1 : "Kickoff"
start_node --> task3 : "Start content"
task1 --> task2 : "User stories done"
task2 --> task4 : "Wireframes approved"
task3 --> task4 : "Content ready"
task4 --> task5 : "Design handed off"
task4 --> task6 : "API specs ready"
task5 --> task7 : "Front-end complete"
task6 --> task7 : "Back-end ready"
task7 --> task8 : "QA passed"
task8 --> task9 : "UAT signed off"
task9 --> end_node : "Go-Live"
@enduml

 

@startuml
left to right direction
title PERT Chart: Website Redesign Project

skinparam object {
    BackgroundColor LightYellow
    BorderColor DarkOrange
    ArrowColor Blue
    ArrowThickness 1.5
}

object "Project Kickoff" as start_node {
  Duration = 0 days
}

object "Task 1: UX Research
& User Stories
[5 days]" as task1 {
  Early Start: Day 0
  Early Finish: Day 5
}

object "Task 2: Wireframing
& Prototyping
[8 days]" as task2 {
  Early Start: Day 5
  Early Finish: Day 13
}

object "Task 3: Content Audit
& Copywriting
[6 days]" as task3 {
  Early Start: Day 0
  Early Finish: Day 6
}

object "Task 4: Visual Design
(UI)
[10 days]" as task4 {
  Early Start: Day 13
  Early Finish: Day 23
}

object "Task 5: Front-End
Development
[12 days]" as task5 {
  Early Start: Day 23
  Early Finish: Day 35
}

object "Task 6: Back-End
Integration
[8 days]" as task6 {
  Early Start: Day 23
  Early Finish: Day 31
}

object "Task 7: QA Testing
& Bug Fixes
[5 days]" as task7 {
  Early Start: Day 35
  Early Finish: Day 40
}

object "Task 8: UAT
(User Acceptance)
[3 days]" as task8 {
  Early Start: Day 40
  Early Finish: Day 43
}

object "Task 9: Deployment
& Go-Live
[2 days]" as task9 {
  Early Start: Day 43
  Early Finish: Day 45
}

object "Project Closure" as end_node {
  Duration = 0 days
}

start_node --> task1 : "Kickoff"
start_node --> task3 : "Start content"
task1 --> task2 : "User stories done"
task2 --> task4 : "Wireframes approved"
task3 --> task4 : "Content ready"
task4 --> task5 : "Design handed off"
task4 --> task6 : "API specs ready"
task5 --> task7 : "Front-end complete"
task6 --> task7 : "Back-end ready"
task7 --> task8 : "QA passed"
task8 --> task9 : "UAT signed off"
task9 --> end_node : "Go-Live"
@enduml