Gantt calendars - excluded dates / holidays
TreeGrid documentation
The calendar specifies the dates that are
not used in Gantt calculation, they are named "
excluded dates". These dates behave like they don't exist at all.
There are two calendars, global (
GanttExclude) and local per row (
GanttCalendar).
You can exclude from dependency calculations and task duration any dates or date range like
weekends,
working hours or any exact
custom dates.
The excluded dates can be shown in chart with different background or can be completely hidden (only global calendar).
Global calendar
Ignores or hides non workdays, non working hours or any other dates in the whole chart
new 6.3 upd 10.0 <C> string
GanttExclude
Can be uploaded to server
Global calendar. It is used for all rows that don't have set custom calendar by
GanttCalendar.
Date ranges hidden from Gantt chart. The ranges are separated by semicolon, the values by tilde and the repeater by '#'.
The format is:
repeater1#date1a~date1b#type1;repeater2#date2a~date2b#type2;...
The
repeater can be one of
GanttDataUnits. If it is missing, the
date is not repeated. The
date is repeated also before it.
(Since 7.0) The type value is by default empty to standard exclude.
If the
type value is set to
0, the defined dates are
included instead of excluded, to return some dates to previously excluded ranges.
The items are processed one by one, so if some date is more times excluded and included, the last result is used.
Other
type values represent given
GanttBackground classes defined by GxGanttBackXXX, where Gx is the style prefix like "GW" for White and XXX is the
type value.
(Since 10.0) There are 11 predefined gray classes from
0 (white) to
10 (black)
(Since 10.0) There are 17 predefined color classes, case
sensitive -
Aqua,
Black,
Blue,
Fuchsia,
Gray,
Green,
Lime,
Maroon,
Navy,
Olive,
Orange,
Purple,
Red,
Silver,
Teal,
White,
Yellow
For example:
GanttExclude = 'w#1/5/2008~1/7/2008; d#00:00~9:00; d#13:00~14:00; d#18:00~24:00' shows only hours 8:00 - 13:00 and 14:00 - 18:00 and only workdays.
(Since 7.0) It is possible to limit the repeating, when the
date range is wider than the
repeater, the range is rounded to the
repeater range and repeated only between the
dates.
For example 'w#1/5/2008~12/29/2008' excludes all weekends, but only in year 2008.
(Since 7.0) It is possible to set the second date before the first one, it will be updated to correctly fill the repeat range.
For example #18:00~8:00' excludes all times from 18:00 to 8:00.
(Since 8.0) It can be also Calendar name, defined in Calendars array.
Remember, excluding too small units (e.g. minutes when chart shows years) can remarkably slow down the Gantt and Exclude calculation. For example GanttExclude='12:00~13:00' will exclude hours, but for '11:55~12:55' will exclude 5 minutes.
Due internal implementation
the chart start date should be rounded to exclude units, check especially GanttChartMaxStart / GanttChartMinStart.
deleted 7.0 <C> string
GanttInclude
Can be uploaded to server
Replaced by
GanttExclude with the third parameter
type = 0
new 6.3 upd 9.1 <C> int
GanttHideExclude
[0] Saved to cookies, to avoid it set <Cfg GanttLap='1'/>
Type of displaying excluded dates:
0 - displayed - all the dates are displayed, the Exclude is used only to specify correct / incorrect dependencies and when moving bars.
1 - hidden - all ranges from exclude are hidden from chart
(the custom calendars in rows can be displayed incorrectly)
2 - displayed like
0, but without background
(new 9.0)
3 - hidden like
1, but without background
(new 9.0)
4 - displayed like
0, but without background for ranges smaller than GanttUnits
(new 9.1)
5 - hidden like
1, but without background for ranges smaller than GanttUnits
(new 9.1)
It is possible to set different zoom settings for case the Exclude is hidden by items with suffix
Ex, like ... GanttWidth:18,GanttWidth
Ex:22 ...
It affects only global calendar defined by GanttExclude, not the custom calendars defined by GanttCalendar.
new 6.3 API method void
SetHideExclude
(bool hide)
Changes
GanttHideExclude and refreshes Gantt and zoom.
If hide is null changes the value 0/1
new 6.3 chg 8.0 <C> int
GanttMaxExclude
[10000000]
Maximal count of units in chart to compute exclude.
The count is computed as (
maxdate-mindate) *
excludeunits.
The
maxdate and
mindate depend on the chart content and also on chart round and minimal column width to display.
The
excludeunits is the smallest unit used in dates in GanttExclude / GanttCalendar. For example
GanttExclude='12:00~13:00' will be hours, but for
'11:55~12:55' will be 5 minutes.
Since 8.0 the default value has been increased to 10 million. And excludes containing more units are ignored and can lead to errors in calculations.
The default 10 million is about 3.8 months for excluded seconds, 19 years for excluded minutes and 1100 years for excluded hours, so it should be enough for all normal excludes.
Local calendar
Ignores non workdays, non working hours or any other dates in particular row
new 8.0 <C> string
GanttCalendar
If set to something, grid supports more calendars (excludes) per grid (one calendar per row).
It will slightly slow down the grid.
Can be set to: | a) column name to be the calendar name or exclude string read from |
| b) calendar name to be the exclude string read from |
| c) direct exclude string |
| d) "1" just to support the custom calendars and read the calendar value from attributes GanttCalendar in individual cells, see below |
Remember, defining many different calendars can remarkably slow down the chart.
The exclude string is described at GanttExclude.
Don't set it, if you want to have only one calendar in grid, set
GanttExclude instead, it will be faster.
new 8.0 <cell> string
GanttCalendar
Custom calendar for given row. Used only when set column
GanttCalendar, see above.
Can be set to: | a) column name to be the calendar name or exclude string read from |
| b) calendar name to be the exclude string read from |
| c) direct exclude string |
These excluded dates are
not affected by
GanttHideExclude.
If the calendar for the row is set empty, it used global calendar from
GanttExclude.
The exclude string is described at GanttExclude.
Calendar list
Defining individual calendars to assign
new 8.0 <Calendars>
<E>
One calendar definition. It can be placed only in root <Calendars> tag.
For example simple definition can be:
<Grid>
...
<Calendars>
<E Name='Workdays' Exclude='w#1/5/2008~1/7/2008'/>
<E Name='Workhours' Exclude='d#18:00~9:00; d#13:00~14:00#1; w#1/5/2008~1/7/2008#2;'/>
<E Name='All' Exclude=''/>
</Calendars>
<Grid>
new 8.0 <E> string
Name
Unique name of the calendar.
This name can be assigned into
GanttExclude and
GanttCalendar attributes.
new 8.0 <E> string
Exclude
Dates excluded in this calendar.
Format is the same as in
GanttExclude.
new 6.4 API variable object[ ]
Calendars
The array of all calendars in grid, accessible by its name.
The calendar objects contain all the XML attributes like Exclude or Name.
Example:
Grid.Calendars.Standard.Exclude = 'w#1/5/2008~1/7/2008';
Use ChangeExclude method for modifications instead of direct changes.
Calendars dialog
Showing dialog to choose calendar
new 8.0 API method void
ShowGanttCalendars
(TRow row, string col, bool sort = 0)
Sets Defaults attribute of the cell to the list of calendars.
Call it from XML event OnClickSideDefaults to show actual list of calendars.
OnClickSideDefaults = "Grid.ShowGanttCalendars(Row,Col)"
If set
sort = 1, it sorts the items according to the alphabet, for 0 it shows them in defined order.
It adds also two predefined options, "None" or "Default" and "Edit".
The "None" is displayed in space row for global calendar and sets the calendar empty. Hide it by
<Lang><Text CalendarNone=""/></Lang>.
The "Default" is displayed in data row for custom calendar and sets the custom calendar to global calendar. Hide it by
<Lang><Text CalendarDefault=""/></Lang>.
The "Edit" is displayed in both locations and shows modal dialog to edit, add and delete all the calendars defined in grid. Hide it by
<Lang><Text CalendarEdit=""/></Lang>.
new 8.0 API method void
EditGanttCalendars
( )
Shows modal dialog to edit, add or delete individual calendars defined in grid.
This dialog is shown also in "Edit..." option in ShowGanttCalendars.
new 8.0 <Cfg> type
CalendarsXXX
Settings for the edit calendars dialog, individual attributes like CalendarsRepeatType. They are the same as
Dates dialog.
Usual definition of the dialog is:
<Cfg CalendarsRepeatType="Enum" CalendarsRepeatEnum="||Weekly|Daily" CalendarsRepeatEnumKeys="||w|d" CalendarsValueType="Float" CalendarsValueFormat="0.00" CalendarsValueCaption="Count" />
new 8.0 <Cfg> type
CalendarsNameXXX
Sets attribute XXX of column
Name in the Calendars Dates grid.
The column
Name is used to show the calendar names in parent rows.
For example:
<Cfg CalendarsNameType="Enum" CalendarsNameEnum="|Standard|Special" CalendarsNameButton="Enum"/>
new 8.0 <Cfg> string
CalendarsTitle
Title of the Calendars Dates grid, shown it top Space row.
new 10.0 API event void
OnDatesClose
(TGrid grid, TGrid dates, bool saved)
Called when the Dates dialog with calendars is closed.
grid is the source grid that opened the Dates dialog.
dates is the grid showing dates dialog.
saved is
false if no changes were done in the
Calendars,
true is when something changed in
Calendars.
Other settings
new 6.3 <C> int
GanttCheckExclude
[1] Saved to cookies, to avoid it set <Cfg GanttLap='1'/>
If and how will be checked placing start of main bar, milestone, point on holidays. It does
not affect run and flag.
0 - place to holiday,
1 - place to the first workday after,
2 - ask user
new 12.0 <C> int
GanttCheckExcludeEdit
[]
If set, overrides the
GanttCheckExclude for editing (source cells) only. Possible values are the same.
new 8.0 upd 10.0 <C> int
GanttChangeExclude
[0]
How will be the main bars updated after the change of excluded dates, bit array. Permitted values are 0, 1, 4, 5
0 - The main bar duration will be updated according to the end date
1 - The main bar end date will be updated according to the duration
4 - If set, it changes dates of all objects to be outside the actually excluded ranges.
The Run is always changed according to its definition - if the bars are defined by end date or by duration.
new 9.1 upd 10.0 <C> bool
GanttExcludeComplete
[0]
If set to
1, the percentage complete in main bar (
since 10.0 also Run) is shown exactly according to the excluded dates - it shows the date where the actually completion finished.
For example if the main bar is 10th - 16th (six days) and 11th - 13th (2 days) are excluded, the completion finishes at 13th for GanttExcludeComplete=0 as half of the six days, but for GanttExcludeComplete it finishes at 14th, as half of 4 working days plus the two excluded days before.
new 7.0 chg 8.0 API method void
ChangeExclude
(string exclude, string name, int type = GanttChangeExclude)
Changes given calendar and recalculates Gantt chart.
exclude is exclude string as in
GanttExclude.
If
name is not set, changes value of
GanttExclude, otherwise changes the calendar
name in Calendars array.
If the
name is "GanttCalendar" it sets column
GanttCalendar value to the
exclude value, use it to disable / enable the custom calendars and recalculate Gantt.
The
type can override
GanttChangeExclude settings.
new 8.0 API method void
CorrectExclude
(TRow row, string col, bool show = 1, string objects = null)
Corrects given Gantt cell to current calendar. All object dates are updated to not be in excluded dates.
If
row is null, it corrects all tasks in grid.
col is Gantt column name.
If
show is 0, it does not changes in the chart and the grid must be rerendered.
objects is comma separated list of objects to update. For null it updates all objects. It can be
main, run, flags, points, constraints.
new 6.3 formula int
gantthasexclude
(string ganttcol)
Returns
0 if exclude is not defined, returns
1 if Exclude is shown, returns
2 if Exclude is hidden.