Skip to content

Commit ab8b3af

Browse files
Merge branch 'development' into 983366-dropdowntree
2 parents 6a9150b + 530915b commit ab8b3af

11 files changed

+601
-521
lines changed

blazor/gantt-chart/accessibility.md

Lines changed: 120 additions & 126 deletions
Large diffs are not rendered by default.

blazor/gantt-chart/adding-new-tasks.md

Lines changed: 66 additions & 54 deletions
Large diffs are not rendered by default.

blazor/gantt-chart/baseline.md

Lines changed: 70 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,88 @@
11
---
22
layout: post
33
title: Baseline in Blazor Gantt Chart Component | Syncfusion
4-
description: Checkout and learn here all about Baseline in Syncfusion Blazor Gantt Chart component and much more.
4+
description: Learn how to configure and style baselines in the Syncfusion Blazor Gantt Chart to compare planned and actual task dates.
55
platform: Blazor
66
control: Gantt Chart
77
documentation: ug
88
---
99

1010
# Baseline in Blazor Gantt Chart Component
1111

12-
The baseline feature enables users to view the deviation between the planned dates and actual dates of the tasks in a project. Baseline dates or planned dates of a task may or may not be same as the actual task dates. The baseline can be enabled by setting the [RenderBaseline](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Gantt.SfGantt-1.html#Syncfusion_Blazor_Gantt_SfGantt_1_RenderBaseline) property to `true` and the baseline color can be changed using the [BaselineColor](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Gantt.SfGantt-1.html#Syncfusion_Blazor_Gantt_SfGantt_1_BaselineColor) property. To render the baseline, you should map the baseline start and end date values from the data source. This can be done using the [GanttTaskFields.BaselineStartDate](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Gantt.GanttTaskFields.html#Syncfusion_Blazor_Gantt_GanttTaskFields_BaselineStartDate) and [GanttTaskFields.BaselineEndDate](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Gantt.GanttTaskFields.html#Syncfusion_Blazor_Gantt_GanttTaskFields_BaselineEndDate) properties. The following code example shows how to enable a baseline in the Gantt Chart component.
12+
The baseline feature in the Syncfusion Blazor Gantt Chart displays the deviation between planned and actual task dates by enabling the [RenderBaseline](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Gantt.SfGantt-1.html#Syncfusion_Blazor_Gantt_SfGantt_1_RenderBaseline) property to `true`. Map planned dates from the data source using [GanttTaskFields.BaselineStartDate](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Gantt.GanttTaskFields.html#Syncfusion_Blazor_Gantt_GanttTaskFields_BaselineStartDate) and [GanttTaskFields.BaselineEndDate](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Gantt.GanttTaskFields.html#Syncfusion_Blazor_Gantt_GanttTaskFields_BaselineEndDate). The data model must include `TaskId`, `TaskName`, `StartDate`, `EndDate`, and optionally `BaselineStartDate` and `BaselineEndDate` for tasks requiring baselines. Customize the baseline appearance with the [BaselineColor](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Gantt.SfGantt-1.html#Syncfusion_Blazor_Gantt_SfGantt_1_BaselineColor) property. The following sections demonstrate enabling baselines and customizing their color.
13+
14+
## Render baselines
15+
16+
Enable baselines by setting `RenderBaseline` to `true` and mapping `BaselineStartDate` and `BaselineEndDate` in the data source. This displays baseline bars alongside actual task bars, using the default color, to highlight scheduling deviations. Ensure valid baseline dates to avoid rendering issues.
1317

1418
{% tabs %}
1519
{% highlight razor tabtitle="Index.razor" %}
1620

1721
@using Syncfusion.Blazor.Gantt
18-
<SfGantt DataSource="@TaskCollection" RenderBaseline="true"
19-
ProjectStartDate="@ProjectStart" ProjectEndDate="@ProjectEnd" Height="450px" Width="700px">
20-
<GanttTaskFields Id="TaskID" Name="TaskName" StartDate="StartDate" EndDate="EndDate"
21-
Duration="Duration" Progress="Progress" ParentID="ParentID" BaselineStartDate="BaselineStartDate"
22-
BaselineEndDate="BaselineEndDate">
22+
@using Syncfusion.Blazor.Grids
23+
24+
<SfGantt DataSource="@TaskCollection" RenderBaseline="true" ProjectStartDate="@ProjectStart" ProjectEndDate="@ProjectEnd" Height="450px" Width="700px">
25+
<GanttTaskFields Id="TaskId" Name="TaskName" StartDate="StartDate" EndDate="EndDate" Duration="Duration" Progress="Progress" ParentID="ParentId" BaselineStartDate="BaselineStartDate" BaselineEndDate="BaselineEndDate">
2326
</GanttTaskFields>
2427
</SfGantt>
2528

26-
@code{
29+
@code {
2730
private DateTime ProjectStart = new DateTime(2022, 04, 01);
28-
private DateTime ProjectEnd = new DateTime(2022, 04, 30);
31+
private DateTime ProjectEnd = new DateTime(2022, 04, 30);
2932
private List<TaskData> TaskCollection { get; set; }
33+
34+
protected override void OnInitialized()
35+
{
36+
this.TaskCollection = GetTaskCollection();
37+
}
38+
39+
public class TaskData
40+
{
41+
public int TaskId { get; set; }
42+
public string TaskName { get; set; }
43+
public DateTime StartDate { get; set; }
44+
public DateTime? EndDate { get; set; }
45+
public DateTime? BaselineStartDate { get; set; }
46+
public DateTime? BaselineEndDate { get; set; }
47+
public string Duration { get; set; }
48+
public int Progress { get; set; }
49+
public int? ParentId { get; set; }
50+
}
51+
52+
public static List<TaskData> GetTaskCollection()
53+
{
54+
List<TaskData> Tasks = new List<TaskData>()
55+
{
56+
new TaskData() { TaskId = 1, TaskName = "Project initiation", StartDate = new DateTime(2022, 04, 05), EndDate = new DateTime(2022, 04, 21), BaselineStartDate = new DateTime(2022, 04, 04), BaselineEndDate = new DateTime(2022, 04, 20) },
57+
new TaskData() { TaskId = 2, TaskName = "Identify site location", StartDate = new DateTime(2022, 04, 05), BaselineStartDate = new DateTime(2022, 04, 06, 08, 00, 00), BaselineEndDate = new DateTime(2022, 04, 06, 08, 00, 00), Duration = "0", Progress = 70, ParentId = 1 },
58+
new TaskData() { TaskId = 3, TaskName = "Perform soil test", StartDate = new DateTime(2022, 04, 05), BaselineStartDate = new DateTime(2022, 04, 04), BaselineEndDate = new DateTime(2022, 04, 08), Duration = "4", Progress = 50, ParentId = 1 },
59+
new TaskData() { TaskId = 4, TaskName = "Soil test approval", StartDate = new DateTime(2022, 04, 09), BaselineStartDate = new DateTime(2022, 04, 08), BaselineEndDate = new DateTime(2022, 04, 12), Duration = "4", Progress = 50, ParentId = 1 },
60+
new TaskData() { TaskId = 5, TaskName = "Project estimation", StartDate = new DateTime(2022, 04, 06), EndDate = new DateTime(2022, 04, 21), BaselineStartDate = new DateTime(2022, 04, 05), BaselineEndDate = new DateTime(2022, 04, 20) },
61+
new TaskData() { TaskId = 6, TaskName = "Develop floor plan for estimation", StartDate = new DateTime(2022, 04, 06), BaselineStartDate = new DateTime(2022, 04, 08), BaselineEndDate = new DateTime(2022, 04, 12), Duration = "4", Progress = 70, ParentId = 5 },
62+
new TaskData() { TaskId = 7, TaskName = "List materials", StartDate = new DateTime(2022, 04, 06), BaselineStartDate = new DateTime(2022, 04, 06), BaselineEndDate = new DateTime(2022, 04, 10), Duration = "4", Progress = 50, ParentId = 5 }
63+
};
64+
return Tasks;
65+
}
66+
}
67+
```
68+
69+
## Customize baseline color
70+
71+
Change the baseline color using the `BaselineColor` property to enhance visibility or match branding. The following example sets a custom orange color for baselines.
72+
73+
```cshtml
74+
@using Syncfusion.Blazor.Gantt
75+
76+
<SfGantt DataSource="@TaskCollection" RenderBaseline="true" BaselineColor="#FF5733" ProjectStartDate="@ProjectStart" ProjectEndDate="@ProjectEnd" Height="450px" Width="700px">
77+
<GanttTaskFields Id="TaskID" Name="TaskName" StartDate="StartDate" EndDate="EndDate" Duration="Duration" Progress="Progress" ParentID="ParentID" BaselineStartDate="BaselineStartDate" BaselineEndDate="BaselineEndDate">
78+
</GanttTaskFields>
79+
</SfGantt>
80+
81+
@code {
82+
private DateTime ProjectStart = new DateTime(2022, 04, 01);
83+
private DateTime ProjectEnd = new DateTime(2022, 04, 30);
84+
private List<TaskData> TaskCollection { get; set; }
85+
3086
protected override void OnInitialized()
3187
{
3288
this.TaskCollection = GetTaskCollection();
@@ -55,7 +111,7 @@ The baseline feature enables users to view the deviation between the planned dat
55111
new TaskData() { TaskID = 4, TaskName = "Soil test approval", StartDate = new DateTime(2022, 04, 05), BaselineStartDate = new DateTime(2022, 04, 08), BaselineEndDate = new DateTime(2022, 04, 12), Duration = "4", Progress = 50, ParentID = 1 },
56112
new TaskData() { TaskID = 5, TaskName = "Project estimation", StartDate = new DateTime(2022, 04, 06), EndDate = new DateTime(2022, 04, 11), },
57113
new TaskData() { TaskID = 6, TaskName = "Develop floor plan for estimation", StartDate = new DateTime(2022, 04, 06), BaselineStartDate = new DateTime(2022, 04, 08), BaselineEndDate = new DateTime(2022, 04, 12), Duration = "4", Progress = 70, ParentID = 5 },
58-
new TaskData() { TaskID = 7, TaskName = "List materials", StartDate = new DateTime(2022, 04, 06), BaselineStartDate = new DateTime(2022, 04, 02), BaselineEndDate = new DateTime(2022, 04, 02), Duration = "0", Progress = 50, ParentID = 5 },
114+
new TaskData() { TaskID = 7, TaskName = "List materials", StartDate = new DateTime(2022, 04, 06), BaselineStartDate = new DateTime(2022, 04, 02), BaselineEndDate = new DateTime(2022, 04, 02), Duration = "0", Progress = 50, ParentID = 5 }
59115
};
60116
return Tasks;
61117
}
@@ -66,4 +122,7 @@ The baseline feature enables users to view the deviation between the planned dat
66122
67123
{% previewsample "https://blazorplayground.syncfusion.com/embed/rXrItkVJAWFMlngY?appbar=false&editor=false&result=true&errorlist=false&theme=bootstrap5" %}
68124
69-
N> You can refer to our [Blazor Gantt Chart](https://www.syncfusion.com/blazor-components/blazor-gantt-chart) feature tour page for its groundbreaking feature representations. You can also explore our [Blazor Gantt Chart example](https://blazor.syncfusion.com/demos/gantt-chart/default-functionalities) to know how to render and configure the gantt.
125+
## See Also
126+
- [Accessibility in Blazor Gantt Chart](https://blazor.syncfusion.com/documentation/gantt-chart/accessibility)
127+
- [Blazor Gantt Chart Feature Tour](https://www.syncfusion.com/blazor-components/blazor-gantt-chart)
128+
- [Blazor Gantt Chart Example](https://blazor.syncfusion.com/demos/gantt-chart/default-functionalities?theme=bootstrap5)

0 commit comments

Comments
 (0)