Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

How to get RenderGraphCore to be called

Solved!
Go to solution

Hi,

 

I am having trouble refreshing the data in my graph. It looks like whenever

graph.Plots[i].Renderer = someRenderer;

or when

graph.Data[i] = someListOfData;

or

graph.Refresh();

is called, the method called RenderGraphCore should be called to rerender the data. My problem is that this is not always true. I am calling graph.Data[i] = someListOfData; twice and the first time I step through the program, it looks like it is getting to RenderGraphCore, the second time, I am modifying the list and then using the same line: graph.Data[i] = someListOfData; and RenderGraphCore is not being called. Is there some explanation of when RenderGraphCore gets fired or why RenderGraphCore isn't being called the second time?

 

Thanks,
Kelly

0 Kudos
Message 1 of 8
(3,007 Views)

Just as some additional information, the second time that I load in new graph data, the graph is not displaying any of the data at that index of the DataCollection.

0 Kudos
Message 2 of 8
(3,001 Views)

If "someListOfData" is the same instance (i.e. "modifying the list" meaning "change the values in the list", instead of "creating a new list"), then assigning the value repeatedly may not be detected as a change (since the collection reference has not changed, only the contents). In this case, I would expect calling the Refresh method would re-render.

 

If you could post a small test application that reproduces the issue, it would help us debug the problem. You may also find this question useful: Wpf graph can't auto refresh (it lists a few approaches to updating data in a graph).

~ Paul H
0 Kudos
Message 3 of 8
(2,992 Views)

Yes, someListOfData is the same instance (the only things that change are some of the point's attributes that passed as traits associated with the buffers of reprocessed data). It appears that Refresh() is stepping into the DecomposeValues() function in the DataTypeDescriptor associated with the points being rendered, so it is reprocessing the data, but it is not rerendering the data onto the graph (so it isn't calling RenderGraphCore()).

 

I can work on a small example application that reproduces the issue.

 

Thanks,
Kelly

0 Kudos
Message 4 of 8
(2,907 Views)
Solution
Accepted by topic author knb

The only reason I can think of for data being processed but the renderer not being called is if your scales have a fixed range (configured with an Adjuster of None), and the new data is outside the current range of the scales. In that case, all the out-of-range data will be discarded, and there will be nothing for the renderer to draw.

~ Paul H
0 Kudos
Message 5 of 8
(2,904 Views)

Hi Paul,

 

It looks like that was the problem. I was not using the buffers that were given to populate the (x, y) locations of the data (I was passing them in using traits) so the buffers were being neglected and set to values between 0-1 and therefore the values would appear to be out of range when my actual values were in range. Just as a follow-up, now that I am not setting the adjuster to None, the GraphInteraction tools for setting the axis ranges aren't working. If I select a new interaction, such as zoomhorizontal, I can select a region using the rectangle, but the graph's actual ranges will not change. Do you have any idea why this might be?

 

Thanks,

Kelly

0 Kudos
Message 6 of 8
(2,898 Views)
Solution
Accepted by topic author knb

From your other question, it sounds like you are updating the data in the graph very frequently. The adjuster is used every time the graph receives new data, so if data is updated right after you zoom in, the adjusters will end up changing the range back to fit the data instead of staying zoomed.

 

Since your application is built around continuous data updates, to avoid this side effect you will need to recognize when you are in an interactive mode and disable scale adjustments. To do this, you could switch from a fit adjuster to a None adjuster whenever the DefaultInteraction on the graph changes. Or you could go back to your original configuration (using a None adjuster on all your scales), and manually update the axis range to fit the new data when you post an update (or leave the range unchanged during interactions).

~ Paul H
Message 7 of 8
(2,888 Views)

Thank you! It seems to be working now.

0 Kudos
Message 8 of 8
(2,880 Views)