Workday and Holiday Exclusion
- 2 minutes to read
When you use the date-time argument scale type, you may need to exclude non-working days from the X-axis scale. The following image shows how to use the DateTimeScaleOptions.WorkdaysOnly property to exclude non-working days.
|Axis.DateTimeScaleOptions.WorkdaysOnly = false||Axis.DateTimeScaleOptions.WorkdaysOnly = true|
When this property is enabled, the DateTimeScaleOptions.WorkdaysOptions property becomes available. The WorkdaysOptions property allows you to specify the following properties:
The WorkdaysOptions.Workdays property allows you to specify which days of the week are work days.
The WorkdaysOptions.Holidays property allows you to modify the collection of holidays. Each holiday is stored in a KnownDate object.
To import holidays from a DevExpress Scheduler (.xml) file or a Microsoft Office Outlook® (.hol) file, use 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 use the WorkdaysOptions.LoadHolidays method to load the file, which has an overload that allows 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 or WorkdaysOptions.Holidays property. For example, when a date exists in the WorkdaysOptions.ExactWorkdays collection, it is always treated as a work day, even if it coincides with a weekend or holiday specified in another property.