Pre loader

Point metadata never matching the dataseries, why?

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

0
0

Hi,

I’m having some problems plotting a graph with pointmetadata. Every time the graph updates, it seems like the id’s of the metadata are different (giving each point new metadatas). Looking at both lists, the count of both are way off and both vary a lot on each update. Shouldn’t both of those lists always match with each other? What could be the problem?

Version
4.0
  • You must to post comments
0
0

Hi Andrew,

I’ve been digging into it a bit more and think I’ve found the problem. I’m “updating the chart” by looping through my data, creating a new DataSeries and assigning it to the existing RenderableSeries. When that is done, the old DataSeries seems to be replaced by the new one but the MetaData that belonged to the old DataSeries never gets deleted, so the MetaData of the new DataSerier is just appended to the end of the list. Using RenderableSeries.DataSeries.Metadata.Clear() just breaks the list (no new values are added after that).

I’m in the process of changing how this update is done, so a DataSeries is only assigned to a RenderableSeries once and then I do the same “filtering” that I was doing previously in my custom PointMaker instead. Hope this works better (and faster, since I can reuse either the loop done in the MoveTo or the Draw one).

  • Andrew Burnett-Thompson
    Hi Daniel, can you share the code for updating the dataseries so we can have a look at it? We might be able to suggest something.
  • You must to post comments
0
0

Hi Andrew,

Oh, I’ve already done quite a few changes to it already and to be honest I don’t know how the policy for sharing code is at my company.

I work for a games company and I use SciChart to plot player data on a graph that represents a top-view of a map. The X and Y coordinates of the graph are used as world-coordinates of the level and I use PointMetaData to store FrameTime and Value (of the data plotted). In the updates I just filtered out data points based on either FrameTime or Value (based on user imput). The code used to be something like this:

var ds = new XyDataSeries<double, double>();
foreach (var point in myPoints)
{
   if (point.FrameTime < minFrameTime || point.FrameTime > maxFrameTime) continue;
   ds.Append(point.X, point.Y, new myPointMetaData(point.Value));
}
MyRenderableSeries.DataSeries = ds;

Now I’m just creating one DataSeries once with all the points, sending FrameTime along with the value as a PointMetaData and doing this filtering inside the PointMaker instead. It seems to do the job quite well and the count of the MetaData now always matches the count of points in the DataSeries (= reliable data displayed). I’m only trying to find how to trigger a Re-Draw/Refresh of the graph once I update properties on my PointMaker.

  • Andrew Burnett-Thompson
    OK fair enough! To trigger a redraw, you can call MyRenderableSeries.OnInvalidateParentSurface(), or dataSeries.InvalidateParentSurface()
  • Jonathan Janesjö
    Thank for the great support Andrew! You’re always fast on your replies and spot on too. :)
  • You must to post comments
0
0

I messed up the upload of the attachment the first time….

Images
  • You must to post comments
Showing 3 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