Workday and Holiday Exclusion
- 2 minutes to read
When using the date-time argument scale type, it is often necessary to exclude non-working days from the X-axis scale. This can easily be done via the DateTimeScaleOptions.WorkdaysOnly property, as illustrated in the following image.
Axis.DateTimeScaleOptions.WorkdaysOnly = false | Axis.DateTimeScaleOptions.WorkdaysOnly = true |
---|---|
When this property is enabled, the DateTimeScaleOptions.WorkdaysOptions property becomes available. It provides the following options.
The WorkdaysOptions.Workdays property allows you to select which days of the week are treated as work days.
The WorkdaysOptions.Holidays property allows you to modify the collection of holidays, each represented by a KnownDate object that stores the holiday name and date.
Instead of specifying holidays manually, you can import them in DevExpress Scheduler (.xml) or Microsoft Office Outlook® (.hol) formats from a file, using the Load Holidays button.
The following image shows the Imported Holidays dialog, where you can choose cultures for holidays you wish to load from an .xml file.
At runtime, you can load the file via the WorkdaysOptions.LoadHolidays method, which has an overload allowing you to specify the culture, if required.
The WorkdaysOptions.ExactWorkdays property allows you to specify work days that do not depend on the WorkdaysOptions.Workdays and WorkdaysOptions.Holidays properties. For example, when a date is present in the WorkdaysOptions.ExactWorkdays collection, it is always treated as work day, even if it coincides with a weekend or holiday specified in another property.