SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and now iOS Charting & Android Chart Components

Welcome to the SciChart Community Forums!

Please use the forums below to ask questions about SciChart. Take a moment to read our Question asking guidelines on how to ask a good question and our support policy

We also have a tag=SciChart on Stackoverflow.com where you can earn rep for your questions!

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
  • Andrew
    Hi Daniel, my first question is “How are you updating the chart?”
  • You must to post comments
0
0

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

Images
  • 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
    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
    OK fair enough! To trigger a redraw, you can call MyRenderableSeries.OnInvalidateParentSurface(), or dataSeries.InvalidateParentSurface()
  • Daniel Reidler
    Thank for the great support Andrew! You’re always fast on your replies and spot on too. :)
  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.