Critical Path feature

22 Jul 20222 minutes to read

The critical path in a project is indicated by a single task or a series of tasks. If a task in critical path is delayed, the entire project will be delayed. A task is considered to be critical if any delay to this task would affect the project end date.

The critical path can be enabled in Gantt by using the built-in toolbar button or enableCriticalPath to true.

@Html.EJS().Gantt("Gantt").DataSource((IEnumerable<object>)ViewBag.DataSource).Height("450px").TaskFields(ts => ts.Id("TaskId").Name("TaskName"
 ).StartDate("StartDate").EndDate("EndDate").Duration("Duration").Progress("Progress").Child("SubTasks")
 ).EnableCriticalPath(true).EditSettings(es => es.AllowAdding(true).AllowEditing(true).AllowDeleting(true)
 ).Toolbar(new List<string>() { "CriticalPath" }).Render()
public IActionResult Index()
{
    ViewBag.DataSource = GanttData.EditingData();	
    return View();
}

Alt text

Customize taskbar in critical path

The taskbar in critical path can be customized by using queryTaskbarInfo event and isCritical property of row data in the event arugment.

The following code example shows how to customize the critical path taskbar in the Gantt control:

@Html.EJS().Gantt("Gantt").DataSource((IEnumerable<object>)ViewBag.DataSource).Height("450px").TaskFields(ts => ts.Id("TaskId").Name("TaskName"
 ).StartDate("StartDate").EndDate("EndDate").Duration("Duration").Progress("Progress").Child("SubTasks")
 ).EnableCriticalPath(true).EditSettings(es => es.AllowAdding(true).AllowEditing(true).AllowDeleting(true)
 ).QueryTaskbarInfo("queryTaskbarInfo").Render()

 <script>
        function queryTaskbarInfo(args) {
             if ((args.data.isCritical || args.data.slack === '0 day') && !args.data.hasChildRecords) {
                args.taskbarBgColor = 'rgb(242, 210, 189)';
                args.progressBarBgColor = 'rgb(201, 169, 166)';
            }
    }
    </script>
public IActionResult Index()
{
    ViewBag.DataSource = GanttData.EditingData();	
    return View();
}

Alt text