Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set gantt tasks to relative dates before a deadline in mermaid

I'm using mermaid js to produce a gantt chart. In the documentation it shows how to set tasks relative to the completion of the prior task using "after x", for example:

section A section
   Completed task            :done,    des1, 2014-01-06,2014-01-08
   Active task               :active,  des2, 2014-01-09, 3d
   Future task               :         des3, after des2, 5d
   Future task2              :         des4, after des3, 5d

Is there any equivalent for setting a task to before a subsequent deadline? I tried replacing "after" with "before" but that didn't work

like image 524
pgcudahy Avatar asked Nov 07 '22 07:11

pgcudahy


1 Answers

Right, mermaid syntax does not support the "before" qualifier, only the "after" qualifier.

Some options to consider are depicted in the "Gantt chart" section on the mermaid-diagrams page of diagrams.net.

title Example Gantt diagram
dateFormat  YYYY-MM-DD
section Team 1
Research & requirements :done, a1, 2020-03-08, 2020-04-10
Review & documentation : after a1, 20d
section Team 2
Implementation      :crit, active, 2020-03-25  , 20d
Testing      :crit, 20d
  1. Use an end date value - like 2020-04-10 for "Research & requirements" task
  2. Use a fixed time duration - like 20d for "Review & documentation" task
  3. Mark the task with ":crit" - like "Implementation" to indicate a "critical path" task

You can also apply the "after" qualifier on the tasks that follow the earlier task that is to be completed before those other tasks.

like image 132
JohnH Avatar answered Nov 14 '22 23:11

JohnH