Pre loader

Building an Axis from AxisBase that uses custom datatype for higher precision.

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


We are evaluating SciChart for use in our product which includes displaying higher precision date time information that the .NET framework DateTime can provide (1 tick = 100ns resolution).

I started by sub-classing the AxisBase class, but I am having issues finding documentation that could help in implement certain methods.

Some of the methods below are outlined–but a full, custom axis example (i.e. example of DateTimeAxis) would be of even greater help.

IRange CalculateYRange(RenderPassInfo renderPassInfo) — Is this only used for YAxis? How does orientation affect the range?

List GetSupportedTypes() — Is this supported IRange types? What types are these?

IRange GetDefaultNonZeroRange() — Is this just the smallest non-Undefined range? Else what is default?

void CalculateDelta() — This has no parameters or return values. The documentation is not clear on what members must need to be set here. Without any example it seem impossible to know how to implement this.

Why does IRange define Diff as type T? In the case of DateRange Diff becomes DateTime. Shouldn’t diff be of type TimeSpan? Are the ticks in the DateTime simply used as a TimeSpan type value? (Assuming Diff is the span of the range). I could implement IRange and use different types (DateTime and TimeSpan) respectively for Min/Max and Diff in this case (assuming I don’t need the templated version of the type.

  • You must to post comments
Good Answer

Hi Riley

We spoke on support ticket which is why this forum post went unanswered, but for the benefit of the community:

  1. Unfortunately in SciChart we have to perform all calculations with the highest-precision, highest dynamic range data-type, which is System.Double. This gives us 53 bits of mantissa, 11 bits of exponent and 1 sign bit.

  2. System.Long has 63 bits for the actual number and 1 bit for sign.

  3. We cannot use System.Decimal for intermediate calculations, as while this has massive precision it has a smaller dynamic range than double.

  4. There is no Long-Double or Double-Double datatype in .NET allowing higher precision in some cases. There are emulated libraries that do 128bit Double or Quad Double but they are very slow.

As a result you have hit the limit of numeric precision and this cannot be easily solved. Precision in SciChart starts in the DataSeries, in the Axis and also in Series drawing so there are far more places to change to achieve higher precision than just the axis.

What we propose for our customers as a workaround is to log the timestamp as a double value, and use our LabelProvider to change the date.

For example:

  1. Say your data starts at 1st January 2016 and ends 1st January 2017.
  2. Log your values as 0, 1, 2 where 0 = 1st Jan 2016 + 00:00:00.000, 1 = 1st Jan 2016 + 00:00:00 + 100ns, 2 = 1st Jan 2016 + 00:00:00 + 200ns
  3. Use LabelProvider API to change values 0,1,2 into real dates with nanosecond precision .

Best regards,

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.