Calculation of critical paths


With my current plan node to see, is divided into two first-level nodes, each first-level node under the child nodes, in my example, the critical path should be these nodes are included, but it is listed here only the second large node and its child nodes, the calculation of this critical path, is not there a problem, is there a way to solve it?

Hello,
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 that shows how it works:
    DHTMLX Snippet Tool

  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

Does the number of days delay play a role in the critical path? As in normal projects, we usually encounter this situation, after the completion of the previous process, we have to wait for many days before the next process, which is actually considered as the critical path.

Hello,
Yes, the number of days between the critical task and its predecessor can affect the critical path. By default, if the predecessor ends earlier than its critical successor, then the predecessor is not considered critical.
It can only happen if you change the lag parameter of the link object. The link object doesn’t have the delay property, so if you add it, it wouldn’t make any effect unless you implement a custom solution.