Adjust to Nonworking Time
Smart.Gantt can automatically adjust the end date of a task, according to the Working Time value. Working Time can be set by three properties:
-
NonworkingDays
- specifies the nonworking days, from0 to 6
, where0
isSunday
Example values:[4, 5, 6]
-- Thursday, Friday & Saturday are nonworking days
-
NonworkingHourse
- specifies the nonworking hours, from0 to 23
, where0
is12 AM
Example values:
-[13, 14, 15]
-- 1 PM, 2 PM, and 3 PM are nonworking hours
-[[1, 6]]
-- The range of hours between 1AM and 6AM are nonworking hours
Note that the values of NonworkingDays
& NonworkingHourse
are taken into consideration
only if AdjustToNonworkingTime
is set to true
-- default value is false
<GanttChart DataSource="Records" DurationUnit="Duration.Hour" View="GanttChartView.Week" DayFormat="GanttDayFormat.Short" NonworkingHours="@nonworkingHours" AdjustToNonworkingTime="true"/> @code{ IEnumerable<object> nonworkingHours = new List<object> { new int[] { 0, 6 }, 13, 14, new int[] {18, 23} }; public List<object> Records = new List<object> { new { Label = "Release", DateStart = "2021-01-01", Duration = 24, Type = "task" } }; }
In the demo above, the "Release" Task has a duration of 24 hours when AdjustToNonworkingTime
is false
However, when AdjustToNonworkingTime
is set to true
,
the Task is automatically adjusted according to the NonworkingHours
property.
The nonworking hours are set to the period between 0-6, 13, 14 and the period between 18-23.
The expected duration of the the "Release" Task is now one week: