Usage ===== GanttChart allows the creation of Gantt charts. Tasks ----- Tasks are created with a title, an end or duration, and optionally an id (one is auto-generated if not given). If the task has an end date it is either a specific date or the string `until id` where *id* is the id of the task this task is active until. If the task has a duration it is specified as *nt* where *n* is an integer and *t* is a letter indicating the duration unit, e.g. *d* for *days*. By default, a task starts at the time the previous task ends. If this is not the case, the start can be specified as a date or the string `after id` where *id* is the id of the task this task starts after. Tasks can be given tags to indicate their status. Milestones ---------- Milestones are created with a title, a start, a duration, and optionally an id (one is auto-generated if not given). The actual point of the milestone on the diagram is *(start + duration)/2*. Vertical Markers ---------------- Vertical markers are created with a title, a start, a duration, and optionally an id (one is auto-generated if not given). The actual point of the vertical marker on the diagram is *start + duration/2*. Vertical markers are purely visual reference points. Sections -------- Sections allow grouping of tasks and milestones; sections are created with a title and tasks and milestones are added. GanttChart ---------- Tasks, milestones, vertical markers, and sections are added to a GanttChart instance. GanttChart allows days of the week, e.g. weekends, to be excluded from task duration calculations, the days that make up a weekend, the input date format, and output date to be specified. Example ------- PHP +++ .. code-block:: php echo Mermaid::create(GanttChart::class) ->withTitle('Adding GANTT diagram functionality to mermaid') ->withExcludes(Exclude::weekends) ->withItem( (new Section('A section')) ->withItem( (new Task('Completed task', '2014-01-08', 'des1')) ->withStart('2014-01-06') ->withTag(Tag::done) , (new Task('Active task', '3d', 'des2')) ->withStart('2014-01-09') ->withTag(Tag::active) , (new Task('Future task', '5d', 'des3')) ->withStart('after des2') , (new Task('Future task2', '5d', 'des4')) ->withStart('after des3') ) , (new Section('Critical tasks')) ->withItem( (new Task('Completed task in the critical line', '24h')) ->withStart('2014-01-06') ->withTag(Tag::critical, Tag::done) , (new Task('Implement parser and jison', '2d')) ->withStart('after des1') ->withTag(Tag::critical, Tag::done) , (new Task('Create tests for parser', '3d')) ->withTag(Tag::critical, Tag::active) , (new Task('Future task in critical line', '5d')) ->withTag(Tag::critical) , new Task('Create tests for renderer', '2d'), new Task('Add to mermaid', 'until isadded'), new Milestone('Functionality added', '2014-01-25', '0d', 'isadded') ) , (new Section('Documentation')) ->withItem( (new Task('Describe gantt syntax', '3d', 'a1')) ->withStart('after des1') ->withTag(Tag::active) , (new Task('Add gantt diagram to demo page', '20h')) ->withStart('after a1') , (new Task('Add another diagram to demo page', '48h', 'doc1')) ->withStart('after a1') ) , (new Section('Last section')) ->withItem( (new Task('Describe gantt syntax', '3d')) ->withStart('after doc1'), new Task('Add gantt diagram to demo page', '20h'), new Task('Add another diagram to demo page', '48h') ) ) ->render() ; Generated Mermaid +++++++++++++++++ .. code-block:: html
gantt
title Adding GANTT diagram functionality to mermaid
dateFormat YYYY-MM-DD
excludes weekends
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
section Critical tasks
Completed task in the critical line : crit, done, 2014-01-06, 24h
Implement parser and jison : crit, done, after des1, 2d
Create tests for parser : crit, active, 3d
Future task in critical line : crit, 5d
Create tests for renderer : 2d
Add to mermaid : until isadded
Functionality added : milestone, isadded, 2014-01-25, 0d
section Documentation
Describe gantt syntax : active, a1, after des1, 3d
Add gantt diagram to demo page : after a1, 20h
Add another diagram to demo page : doc1, after a1, 48h
section Last section
Describe gantt syntax : after doc1, 3d
Add gantt diagram to demo page : 20h
Add another diagram to demo page : 48h
Mermaid Diagram
+++++++++++++++
.. mermaid::
gantt
title Adding GANTT diagram functionality to mermaid
dateFormat YYYY-MM-DD
excludes weekends
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
section Critical tasks
Completed task in the critical line : crit, done, 2014-01-06, 24h
Implement parser and jison : crit, done, after des1, 2d
Create tests for parser : crit, active, 3d
Future task in critical line : crit, 5d
Create tests for renderer : 2d
Add to mermaid : until isadded
Functionality added : milestone, isadded, 2014-01-25, 0d
section Documentation
Describe gantt syntax : active, a1, after des1, 3d
Add gantt diagram to demo page : after a1, 20h
Add another diagram to demo page : doc1, after a1, 48h
section Last section
Describe gantt syntax : after doc1, 3d
Add gantt diagram to demo page : 20h
Add another diagram to demo page : 48h