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!

Please note: SciChart team will only answer questions from customers with active support subscriptions. Expired support questions will be ignored. If your support status shows incorrectly, contact us and we will be glad to help.

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.