11-28-2012 09:53 AM
I get this error sometimes after adding new plot to the graph:
graph.Plots.Add(_newPlot);
graph.Data[_newPlot.Index] = graph.Data[_plot.Index];
How do I prevent this?
11-28-2012 10:00 AM
Sorry, what is the error? I think you didn't attach something.
11-28-2012 10:01 AM - edited 11-28-2012 10:01 AM
Cannot draw outside of a draw cycle
I don't see where this exception is coming from
11-28-2012 04:34 PM
There is a known issue with how the graph performs rendering in the current release of Measurement Studio (in that case, resizing the graph while it was rendering caused the exception).
I created a project containing a graph with one plot and a button with the code below, but was not able to reproduce your issue:
int i = graph.Plots.Count;
graph.Plots.Add( new Plot() );
graph.Data[i] = graph.Data[i - 1];
12-03-2012 02:28 AM
Maybe difference is that I output data to the graph all the time in parallel. Should I use some lock on the graph?
12-03-2012 09:20 AM
In general, UI controls are tied to the UI therad and cannot be updated in parallel. There are some specific scenarios where we support observed updates with later DAQmx driver versions, but in general all changes need to go through the UI thread.
12-03-2012 10:03 AM
I update graph data using Invoke, and also add plots in UI thread, so this shouldn't be an issue...
12-03-2012 03:01 PM
Could you provide a sample program that reproduces the issue? Or at least post the stack trace in the exception?
09-03-2013 07:28 AM
Don't know if this was ever fixed but I get the same error sometimes when manipulating a RangeCursor while the graph is updating. Here is the stack trace below. NOTE: I am not on the latest NI libraries yet, I haven't updated in about 7 months.
09-03-2013 08:47 AM
From the "PlotArea.OnSizeChanged" call in your stack trace, I think your problem is more likely related to this question, which was fixed in Measurement Studio 2013.