Critical path problem

Hi developer,

I test gantt in our one project. But I think it is a bug. The critical path is different from p6. I attached the demo data including calendars.
demo-data-calendars.txt (96.3 KB)

and I think these link lines should show red color.

Hello Sang,

I test gantt in our one project. But I think it is a bug. The critical path is different from p6. I attached the demo data including calendars.

Gantt uses its own logic to define when a task should be critical. It was not intended to work the same way as in Primavera. If you need the same behavior as in Primavera, you will need to implement a custom solution by using the Gantt API and Javascript.

I see that the tasks have the links with the lag parameter. Most likely, the tasks are considered critical because of that. But I didn’t check it as if you have a lot of tasks and links.

Gantt considers a task as a critical one in the following cases:

  1. The task has the latest end date in the whole chart.

  2. The task is connected to a critical task, and the lag between them is 0.
    The lag depends on the gantt.config.duration_unit parameter. When the duration_unit is 'day' and duration between tasks is several hours, Gantt will round the duration.
    If the link between tasks has the lag parameter, it allows changing the duration between tasks. When it is 1, the task becomes critical when the duration between tasks is 1. Here is the demo of those parameters:
    link.lag is 0:
    Screenshot by Lightshot
    link.lag is 1:
    Screenshot by Lightshot
    link.lag is -1:
    Screenshot by Lightshot

  3. The gantt.config.project_end parameter is specified and the task dates are greater than the gantt.config.project_end date.

Unfortunately, there is no way to change the built-in logic that defines the critical path.
But you can highlight tasks and links manually. If you return gantt_critical_task in the task_class template, the task will be highlighted as a critical one. If you return gantt_critical_link in the link_class template, the link will be highlighted as a critical one:
https://docs.dhtmlx.com/gantt/api__gantt_task_class_template.html
https://docs.dhtmlx.com/gantt/api__gantt_link_class_template.html

Here is an example:
custom critical path per project:
http://snippet.dhtmlx.com/eb05a1f90

You can read about the logic in the following article:
https://docs.dhtmlx.com/gantt/desktop__critical_path.html


and I think these link lines should show red color.

The link with the project task should be critical as its child task is critical. The bug here is that the project task is not red.

The link with the Develop System task is critical because it originates from the Interface setup task, which is critical.
It works the same way as in MS Project, so probably, that shouldn’t be a bug:

Thank you Ramil! :heart:, I will test again.