Gantt Chart Add tasks dynamically

I would like to create a gantt chart. And I iterate through a loop, add a new task/rectangle in. Is there a command/function add a task to an exsisting gantt figure?