WorkdaysOptions.Holidays Property

Specifies holidays for excluding them from the date-time axis scale.

Namespace: DevExpress.XtraCharts

Assembly: DevExpress.XtraCharts.v21.2.dll

Declaration

[PersistenceMode(PersistenceMode.InnerProperty)]
public KnownDateCollection Holidays { get; }

Property Value

Type Description
KnownDateCollection

A KnownDateCollection object, that stores the information about holidays.

Property Paths

You can access this nested property as listed below:

Object Type Path to Holidays
DateTimeScaleOptions
.WorkdaysOptions.Holidays

Remarks

Use the Holidays property, to manually populate the collection of holidays.

Alternatively, you can import holidays in the DevExpress Scheduler (.xml) or Microsoft Office Outlook® (.hol) formats from a file, via the WorkdaysOptions.LoadHolidays method.

Note

If a date is defined as both a holiday (via the Holidays property) and strict workday (via the WorkdaysOptions.ExactWorkdays property), it is considered working day, and, consequently, it is not excluded from the axis scale.

For more information, refer to Data Aggregation.

Example

This example demonstates how to exclude non-working days (weekdays and holidays) from an axis range, via the AxisBase.WorkdaysOnly and AxisBase.WorkdaysOptions properties.

using System;
using System.Windows.Forms;
using DevExpress.XtraCharts;
// ...
AxisX axisX = ((XYDiagram)chartControl1.Diagram).AxisX;

// Exclude holidays from the axis scale.
axisX.WorkdaysOnly = true;

// Specify custom working days.
axisX.WorkdaysOptions.Workdays = Weekday.Sunday | Weekday.Monday | Weekday.Tuesday |
    Weekday.Wednesday | Weekday.Thursday | Weekday.Friday;

// Specify holidays
axisX.WorkdaysOptions.Holidays.AddRange(new KnownDate[] {
    new KnownDate("Custom Holiday 1", new DateTime(1994, 3, 2, 0, 0, 0, 0)),
    new KnownDate("Custom Holiday 2", new DateTime(1994, 4, 2, 0, 0, 0, 0))});

// Specify strict working days.
// Thay will have a priority over the holidays specified.
axisX.WorkdaysOptions.ExactWorkdays.Add(
    new KnownDate("Community Work Day", new DateTime(1994, 3, 2, 0, 0, 0, 0)));
See Also