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
- deepakb1 asked 10 years ago
- You must login 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,
Andrew
- Andrew Burnett-Thompson answered 10 years ago
- You must login to post comments
Please login first to submit.