DateTimePeriod Class
A date-time period that can be used to select a predefined range in the Range Filter using its context menu.
Namespace: DevExpress.DashboardCommon
Assembly: DevExpress.Dashboard.v18.2.Core.dll
Declaration
public class DateTimePeriod :
IXmlSerializableElement,
IDateTimePeriodLimitOwner,
INameContainer,
INamedItem,
ISupportPrefix,
IDateTimePeriod
Related API Members
The following members return DateTimePeriod objects:
Remarks
The RangeFilterDashboardItem class exposes the RangeFilterDashboardItem.DateTimePeriods property providing access to a collection of predefined date-time periods.
To add the required date-time period in code, create the DateTimePeriod class instance and perform the following steps.
- Specify required boundaries for the created period. To do this, create the FixedDateTimePeriodLimit or FlowDateTimePeriodLimit class objects and specify its settings.
- Pass the specified date-time boundaries to the DateTimePeriod constructor or assign these objects to the DateTimePeriod.Start/DateTimePeriod.End properties.
Note
If you do not specify DateTimePeriod.Start/DateTimePeriod.End, the selection will begin from the start/end of the visible range.
- Specify the period name using the DateTimePeriod.Name property.
- Add the resulting DateTimePeriod object to the RangeFilterDashboardItem.DateTimePeriods collection.
If necessary, you can specify the default selected range for the Range Filter. To do this, assign the DateTimePeriod.Name value to the RangeFilterDashboardItem.DefaultDateTimePeriodName property.
Example
This example shows how to create a predefined date-time period for the Range Filter dashboard item.
RangeFilterDashboardItem rangeFilter = new RangeFilterDashboardItem();
// ...
FixedDateTimePeriodLimit startDate = new FixedDateTimePeriodLimit(new System.DateTime(2015, 1, 1));
FlowDateTimePeriodLimit endDate = new FlowDateTimePeriodLimit(DateTimeInterval.Month, -1);
DateTimePeriod customPeriod = new DateTimePeriod("Custom period", startDate, endDate);
rangeFilter.DateTimePeriods.Add(customPeriod);