Pre loader

DataSeriesSet.XRange.Min has wrong type


I have a DataSeriesSet<DateTime,double> with multiple DataSeries. I want to know the XRange for this set, which should be IRange<DateTime>. When I look at the XRange in the debugger I can see that the range is SciChart.DoubleRange. The values in this range are both in the vicinity of 6E+17, which is almost certainly the Ticks value of the associated DateTime.

I think this should be a DateTime range. Coercing Ticks to double and back to Ticks is likely to produce some floating point rounding error. If I’m comparing DateTime values through this coercion then there’s a good chance that comparison for =, <= and >= could falsely fail.

  • You must to post comments

You’re right in saying its the DateTime.Ticks as a double value, however this is needed because all calculations internal to SciChart are performed using double-precision arithmetic.

XRange is a property we use to compute the ZoomExtents range (e.g. maximum range of the XAxis). The only reason this is public is because our software is built using interfaces (which require public implementation), so that we can write extensive unit tests and use techniques such as mocking.

Do remember that calculations internal to scichart are only needed for rendering, hence rounding error is acceptable to us.

If you wish to get the true X-Range (which , then you simply need to union the ranges of DataSeries.XValues[0] and DataSeries.XValues[DataSeries.Count-1] for all DataSeries. The data is stored as DateTime always, only the range calculations use Double as an intermediary.

I hope this helps!


  • asthomas
    Thanks. I'll find the X extends as you suggest.
  • 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