Articles in this section
Category / Section

Is it possible to set DateTime Range and DateTime Intervals?

1 min read


Chart control has the ability to have date-time values. In addition to this, the axis range and interval can also be set for date-time values. Refer to the attached sample and the following code snippets for using this feature.

Date-time range can be set using the Axis.DateTimeRange property.


Chart1.Areas[0].PrimaryAxis.IsAutoSetRange = false;

Chart1.Areas[0].PrimaryAxis.DateTimeRange = new DateTimeRange(new DateTime(2009, 2, 1, 0, 0, 0), new DateTime(2009, 2, 15, 0, 0, 0));


Date-time interval can be set using the Axis.DateTimeInterval property.


Chart1.Areas[0].PrimaryAxis.DateTimeInterval = new TimeSpan(2, 0, 0, 0);



Custom ranges set will be effective only when the Axis.IsAutoSetRange property is set to false as shown in the above codes.

Did you find this information helpful?
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment