Pre loader

Is a generic XyDataSeries posssible? (TX as IComparable)

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

Answered
0
0

Hello SciChart-Team!

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

Exception:
Cannot create a DataDistributionCalculator for the type TX=System.IComparable

Stacktrace:

   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?

Regards
Michael

Version
4.2.0.9227
  • You must to post comments
Great Answer
1
0

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>()

I use
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.

Regards
Michael

  • Andrew Burnett-Thompson
    Hi Michael. Of course! Apologies, I must have misread your question. I’m glad you got it sorted though and thank you for posting the answer. Best regards, Andrew
  • You must to post comments
0
0

I am considering applying server-side licensing for my javerScript application.

In the document below, there is a phrase “Our server-side licensing component is written in C++.”
(https://support-dev.scichart.com/index.php?/Knowledgebase/Article/View/17256/42/)

However, there is only asp.net sample code on the provided github.
(https://github.com/ABTSoftware/SciChart.JS.Examples/tree/master/Sandbox/demo-dotnet-server-licensing)

I wonder if there is a sample code implemented in C++ for server-side licensing.

Can you provide c++ sample code?
Also, are there any examples to run on Ubuntu?

  • You must to post comments
Showing 2 results
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