BaseLine in ASP.NET CORE Syncfusion Gantt Component
11 Sep 202513 minutes to read
The baseline feature in the Gantt component enables comparison between original planned schedules and actual task execution timelines. This visualization provides clear insights into schedule deviations, helping assess project performance and identify areas requiring attention. Baseline functionality displays both the original planned timeline and current progress side-by-side for comprehensive project tracking.
Before implementing baseline functionality, ensure the data source includes baseline date fields and configure the taskFields object with appropriate field mappings. The baseline feature requires proper field mapping to display planned versus actual timelines effectively.
Baseline fields:
- baselineStartDate: Represents the originally planned start date of a task. This value is used to compare against the actual start date to identify schedule deviations.
- baselineEndDate: Represents the originally planned end date of a task. It is used to compare against the actual end date.
-
baselineDuration: Represents the total planned duration of the task. This value is critical for baseline visualization. To represent a baseline milestone, this property must be explicitly set to
0
. SettingbaselineStartDate
andbaselineEndDate
to the same value without settingbaselineDuration
to0
will result in a one-day baseline task, not a milestone.
Implement baseline
To enable baseline, configure the Gantt component by setting renderBaseline to true
, mapping baselineStartDate
, baselineEndDate
, and optionally baselineDuration
in taskFields
. To customize appearance set the baselineColor property or the .e-baseline-bar
CSS class for advanced styling.
List<GanttDataSource> data = new List<GanttDataSource>
{
...
new GanttDataSource
{
TaskID = 7,
TaskName = "List materials",
StartDate = new DateTime(2019, 4, 4),
Duration = 3,
Progress = 50,
ParentID = 5,
BaselineStartDate = new DateTime(2019, 4, 2),
BaselineEndDate = new DateTime(2019, 4, 4),
BaselineDuration = 2 // Regular baseline
},
new GanttDataSource
{
TaskID = 8,
TaskName = "Estimation approval",
StartDate = new DateTime(2019, 4, 4),
BaselineStartDate = new DateTime(2019, 04, 02),
Duration = 0,
Progress = 50,
ParentID = 5,
BaselineDuration = 0 // Milestone baseline
}
};
// Here you can customize base line color.
<ejs-gantt id='Gantt' dataSource="ViewBag.dataSource" height="450px" renderBaseline="true" baselineColor="red" projectStartDate="03/31/2019" projectEndDate="05/31/2019">
...
</ejs-gantt>
.e-gantt .e-gantt-chart .e-baseline-bar {
height: 4px;
border-radius: 2px;
opacity: 0.9;
background-color: #4CAF50;
}
The following example demonstrates complete baseline configuration with proper field mapping:
<ejs-gantt id='Gantt' dataSource="ViewBag.dataSource" height="450px" renderBaseline="true" baselineColor="red" projectStartDate="03/31/2019" projectEndDate="05/31/2019">
<e-gantt-taskfields id="TaskID" name="TaskName" startDate="StartDate" duration="Duration" progress="Progress" baselineStartDate="BaselineStartDate" baselineEndDate="BaselineEndDate" baselineDuration="baselineDuration" parentID="ParentID">
</e-gantt-taskfields>
</ejs-gantt>
public IActionResult Index()
{
ViewBag.DataSource = ganttData();
return View();
}
public static List<GanttDataSource> ganttData()
{
List<GanttDataSource> data = new List<GanttDataSource>
{
new GanttDataSource
{
TaskID = 1,
TaskName = "Project Initiation",
StartDate = new DateTime(2019, 4, 2),
EndDate = new DateTime(2019, 4, 21)
},
new GanttDataSource
{
TaskID = 2,
TaskName = "Identify Site location",
StartDate = new DateTime(2019, 4, 2),
Duration = 0,
Progress = 50,
ParentID = 1,
BaselineStartDate = new DateTime(2019, 4, 2),
BaselineEndDate = new DateTime(2019, 4, 6)
},
new GanttDataSource
{
TaskID = 3,
TaskName = "Perform Soil test",
StartDate = new DateTime(2019, 4, 2),
Duration = 4,
Progress = 50,
ParentID = 1,
Predecessor = "2FS",
BaselineStartDate = new DateTime(2019, 4, 4),
BaselineEndDate = new DateTime(2019, 4, 9),
BaselineDuration = 5
},
new GanttDataSource
{
TaskID = 4,
TaskName = "Soil test approval",
StartDate = new DateTime(2019, 4, 2),
Duration = 4,
Progress = 50,
ParentID = 1,
BaselineStartDate = new DateTime(2019, 4, 8),
BaselineDuration = 4
},
new GanttDataSource
{
TaskID = 5,
TaskName = "Project Estimation",
StartDate = new DateTime(2019, 4, 2),
EndDate = new DateTime(2019, 4, 21)
},
new GanttDataSource
{
TaskID = 6,
TaskName = "Develop floor plan for estimation",
StartDate = new DateTime(2019, 4, 4),
Duration = 3,
Progress = 50,
ParentID = 5,
BaselineStartDate = new DateTime(2019, 4, 4),
BaselineEndDate = new DateTime(2019, 4, 8)
},
new GanttDataSource
{
TaskID = 7,
TaskName = "List materials",
StartDate = new DateTime(2019, 4, 4),
Duration = 3,
Progress = 50,
ParentID = 5,
BaselineStartDate = new DateTime(2019, 4, 2),
BaselineEndDate = new DateTime(2019, 4, 4),
BaselineDuration = 2
},
new GanttDataSource
{
TaskID = 8,
TaskName = "Estimation approval",
StartDate = new DateTime(2019, 4, 4),
BaselineStartDate = new DateTime(2019, 04, 02),
Duration = 0,
Progress = 50,
ParentID = 5,
BaselineDuration = 0
}
};
return data;
}
public class GanttDataSource
{
public int TaskID { get; set; }
public string? TaskName { get; set; }
public DateTime StartDate { get; set; }
public DateTime BaselineStartDate { get; set; }
public DateTime BaselineEndDate { get; set; }
public int? BaselineDuration { get; set; }
public DateTime? EndDate { get; set; }
public int? Duration { get; set; }
public int? Progress { get; set; }
public int? ParentID { get; set; }
public string? Predecessor { get; set; }
public List<int>? Resources { get; set; }
}
The following screenshot shows the baseline in Gantt control.