I’m trying to give the user of my application the ability to switch between relative (TimeSpan) or absolute (DateTime) time on the X-Axis inside the graph.
I know that I could go with two separate XyDataSeries objects, one for each type but I’d rather not do this because of memory consumption. (millions of datapoints that would need to be stored in memory twice)
My idea would have been to make my code generic with an IComparable instead of TimeSpan or DateTime. Like this:`
new XyDataSeries<IComparable, double>()
The application would then decide on startup which X-Values it should go with and either show a TimeSpanAxis or a DateTimeAxis.
Sadly, this doesn’t work.
When initializing an XyDataSeries like that I get a NotImplementedException
Cannot create a DataDistributionCalculator for the type TX=System.IComparable
at A.c5777c70d4cd0dda50a2117fa1aaa10fc.c368dd1d74117b21c11923a7963ca446f[c96cfda5e71b9e51b60daed32a29c7426](Boolean c9d35973164d478a320e72d2740e74116) at SciChart.Charting.Model.DataSeries.DataSeries`2.Clear() at SciChart.Charting.Model.DataSeries.DataSeries`2..ctor() at SciChart.Charting.Model.DataSeries.XyDataSeries`2..ctor(Int32 capacity) at PreSens.PMS2.ViewModels.Charting.SingleChannel.ChartData..ctor() in C:\**redacted**\ChartData.cs:line 91
Is this a bug or is this feature not yet implemented? Or is this not possible at all?
If it’s not possible to do it that way, what would you recommend to solve this problem with relative and absolute time?
I couldn’t solve my issue by using the PointMetadata API. That was not what I was looking for.
What I did now is that instead of
new XyDataSeries<TimeSpan, double>()
new XyDataSeries<long, double>()
This allows me to use either the TimeSpan ticks or DateTime ticks as the X-Value for my graph. In the UI I use a regular NumericAxis with a custom label provider that, depending on user configuration, converts the ticks to a DateTime or a TimeSpan value.
Morning! (Or afternoon depending on timezone 🙂 )
Have a look at DataSeries Types in SciChart. At the moment:
NOTE: Allowable types in SciChart include DateTime, TimeSpan, Int64, Int32, Int16, Byte, Double, Float, UInt64, UInt32, UInt16, SByte.
DateTime, TimeSpan are only allowable on TX. The type Decimal (128) bit is not allowed. Custom types are not allowed.
If you want to include custom data per-point you can do so using our PointMetadata API. This is an optional API to include any type on some or all data-points. PointMetadata can be passed through to tooltips and paletteprovider, or used for custom drawing.
Let me know if this helps,
Please login first to submit.