SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and now iOS Charting & Android Chart Components

Welcome to the SciChart Community Forums!

Please use the forums below to ask questions about SciChart. Take a moment to read our Question asking guidelines on how to ask a good question and our support policy

We also have a tag=SciChart on Stackoverflow.com where you can earn rep for your questions!

0
0

Hi,

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.

Thanks,
Deepak

Images
  • You must to post comments
0
0

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,
Andrew

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.