Pre loader

CategoryDateTimeAxis Error

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums



I’m trying to set the Visible Range of a CategoryDateTime Axis and its throwing an “Object must be of type DateTime” exception. Can you tell me whats wrong here

var scs = new SciChartSurface();
scs.XAxis = new CategoryDateTimeAxis() { DrawMajorGridLines = false, DrawMinorGridLines = false,AutoRange=AutoRange.Never };
scs.YAxis = new NumericAxis() { Id = "Y1", DrawMajorGridLines = false, DrawMinorGridLines = false };
scs.Style = (System.Windows.Style)this.chartForm.sciChartControl.Resources["SciChartSurfaceStyle"];
DateTime startDate = new DateTime(2003, 9, 1);
DateTime endDate = new DateTime(2004, 1, 31);
scs.XAxis.VisibleRange = new DateRange(startDate, endDate);

The exception gets thrown on the last line. I also tried populating the series before I called the visible range, but it has not effect on the exception.


  • You must to post comments

Hi Deepak,

The CategoryDateTimeAxis expects VisibleRange of type IndexRange. This specifies the start/end indices of the bars to show on the chart. This is because this axis does not measure by Dates at all but point index, so that it can collapse gaps e.g. at weekends.

Hope this helps,

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.