Project task should only calculate actual subtasks duration and shows gap if there is no subtask at a point of time

Hi Team,

Not sure, if it is right place to ask this question. We are using pro version of Gantt Chart and have very custom requirement we seek some help to understand whether it is doable and if yes then some pointer how can we achieve it.

Please take a look on attached image this is what we want. currently we have gantt chart with project and tasks. the project is dependent on tasks and if you move the task timeline the project will also change. Currently our project shows whole time line from minimum start date to maximum end date of the sub task. So the duration also calculate the free time or the time when there is a gap between two tasks.
what we require is only sum of actual tasks time duration and not any gap. Also we want to show that gap on project timeline where there is no active task exist.

let me know if we can achieve something like that. one thing which we would like to retain is, the project should continue having dependency on the tasks, so if I change the task it should automatically update the project.

Appreciates all your help.

Hello,
There is no built-in way to make it work that way. You need to implement a custom solution.

You can display subtasks in the task_text template that allows showing any HTML elements inside the task element in the timeline:
https://docs.dhtmlx.com/gantt/api__gantt_task_text_template.html
Here is an example with the task names:
http://snippet.dhtmlx.com/5/77da1377a
And here is another example with empty rectangles:
http://snippet.dhtmlx.com/5/697a19a73
To show gaps instead of the actual project, you can add the white color style rule for the project elements:
http://snippet.dhtmlx.com/5/4e1f7e786

You can also implement it by using the addTaskLayer feature:
https://docs.dhtmlx.com/gantt/api__gantt_addtasklayer.html
Here is an example of how it might be implemented:
https://snippet.dhtmlx.com/5/4e31c22f9

Project tasks ignore the date parameters(start_date, end_date and duration). There is no way to change how it works.
However, you can calculate the duration of subtasks in a function and show it in the grid by using the template function:
https://docs.dhtmlx.com/gantt/desktop__specifying_columns.html#datamappingandtemplates

The following example can help you to start:
http://snippet.dhtmlx.com/5/9005b5446