DateTimeScaleOptions.WorkdaysOnly Property

Specifies whether holidays and non-working days should be excluded from the axis scale.

Namespace: DevExpress.XtraCharts

Assembly: DevExpress.XtraCharts.v20.1.dll


public bool WorkdaysOnly { get; set; }
Public Property WorkdaysOnly As Boolean

Property Value

Type Description

true, to exclude non-working days from the axis scale; otherwise, false.

Property Paths

You can access this nested property as listed below:


The WorkdaysOnly property is available for an axis, if its scale type is date-time.

WorkdaysOnly = false WorkdaysOnly = true
WorkdaysOnly_false WorkdaysOnly_true

After the WorkdaysOnly property is enabled, the ScaleOptions.DateTimeScaleOptions.WorkdaysOptions property becomes available, which allows you to specify non-working days, holidays and strict workdays for the axis scale.

For more information, refer to Data Aggregation.


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.
    new KnownDate("Community Work Day", new DateTime(1994, 3, 2, 0, 0, 0, 0)));
See Also