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



I am using CategoryDateTimeAxis for creation so my VisibleRange is an IndexRange. When I am loading my whole data over chart, I want to set VisibleRange for 3 month by default. So how can I get Min and Max value from VisibleRange as DateTimes?

I don’t see any method which would convert our DateRange to IndexRange and vice verse, so that I can set up my VisibleRange.

Please help!

  • You must to post comments

Hi Swati,

Thanks for getting in touch.

Can you try to use the method CategoryDateTimeAxis.ToDateRange(IndexRange) to convert IndexRanges to DateRange?

Also, CategoryDateTimeAxis.GetCoordinate(IComparable), CategoryDateTimeAxis.GetDataValue(double) are able to perform a conversion from a data point index to DateTime and vice versa.

I hope this helps,

Best regards,

  • swati
    thanks for your help now i am able to cast like below DateRange dt1 = new DateRange(new DateTime(2013, 6, 1), new DateTime(2013, 9, 1)); double dval1 = this.Axis.GetCoordinate(dt1.Min); double dval2 = this.Axis.GetCoordinate(dt1.Max); IComparable inRange1= this.Axis.GetDataValue(dval1); IComparable inRange2= this.Axis.GetDataValue(dval2); but now how i can take this data for my visible range or index range or some how i can get min or max .. Please help .... please
  • Olya
    Ah ok I see, can you try this code instead? IComparable inRange1= this.Axis.GetDataValue(dval1); IComparable inRange2= this.Axis.GetDataValue(dval2); var coordCalc = GetCurrentCoordinateCalculator() as ICategoryCoordinateCalculator; if (coordCalc != null) { VisibleRange = new IndexRange( coordCalc.TransformDataToIndex(inRange1), coordCalc.TransformDataToIndex(inRange2)); } This should work for you. Please let me know if it helps. Best regards, Olya
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.