Pre loader

CategoryAxis VisibleRange as DateRange

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

0
0

Hi,

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
0
0

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

  • 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.

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies