Tasks Hierarchy

Overview

it is very important to have the ability to define the hierarchy of tasks in order to show complex projects or several projects on one Gantt plot. AnyGantt features two ways of hierarchy definition - using "parent-child" definition or "levels". Please choose the method that better fits your data - they are equal in rights.

Parent tasks

You can assign any task an id of its parent task - and organize a proper structure of your projects, don't forget that as soon as you define one task as a parent of another - parent task becomes Summary task and looks in other way (this can be changed, see Task Types Tutorial):

<anygantt>
  
<project_chart>
    
<tasks>
      
<task id="1" name="Task 1" parent="" actual_start="2008.07.01" actual_end="2008.07.12" />
      
<task id="2" name="Task 1" parent="1" actual_start="2008.07.01" actual_end="2008.07.07" />
      
<task id="3" name="Task 2" parent="2" actual_start="2008.07.04" actual_end="2008.07.09" />
      
<task id="4" name="Task 3" parent="3" actual_start="2008.07.05" actual_end="2008.07.12" />
    
</tasks>
  
</project_chart>
</anygantt>

Sample Chart shows how tasks are shown when hierarchy set using parent attribute.

Parent hierarchy sample - Click to see Live Chart Preview
Parent hierarchy sample - Click to see Live Chart Preview

to top

Levels

Alternative way of setting hierarchy of tasks is setting levels. Level "0" stands for root tasks and every task that follows with a higher level is made child task. Don't forget that as soon as task of higher level becomes parent of another - it becomes Summary task and looks in other way (this can be changed, see Task Types Tutorial)

<anygantt>
  
<project_chart>
    
<tasks>
      
<task id="1" name="Task 1" level="0" actual_start="2008.07.01" actual_end="2008.07.12" />
      
<task id="2" name="Task 2" level="1" actual_start="2008.07.01" actual_end="2008.07.07" />
      
<task id="3" name="Task 3" level="2" actual_start="2008.07.04" actual_end="2008.07.09" />
      
<task id="4" name="Task 4" level="3" actual_start="2008.07.05" actual_end="2008.07.12" />
      
<task id="5" name="Task 5" level="1" actual_start="2008.07.01" actual_end="2008.07.07" />
      
<task id="6" name="Task 6" level="2" actual_start="2008.07.04" actual_end="2008.07.09" />
      
<task id="7" name="Task 7" level="2" actual_start="2008.07.05" actual_end="2008.07.12" />
    
</tasks>
  
</project_chart>
</anygantt>

Sample Chart shows how tasks are shown when hierarchy set using level attribute.

Levels hierarchy sample - Click to see Live Chart Preview
Levels hierarchy sample - Click to see Live Chart Preview

Expand/Collapse

Summary tasks not only look different, but also - expand/collapse icon appears against it in the datagrid. You can control if the summary task is expanded or collapsed by default, using expanded attribute of task node. Both sample above show expanded and collapsed by default tasks.

Sample XML shown below:

<task id="5" name="Task 5" actual_start="2008.07.01" actual_end="2008.07.07" expanded="false" />

 

to top