SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and now iOS Charting & Android Chart Components
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’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 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!
Please login first to submit.