LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Graph control not discarding data on some systems

I have a graph control in my user interface that is set as an indicator/discard data. On one of our computers the previous data is discarded every time I plot a new waveform using "PlotWaveform". On another computer it does not discard the previous data. I have tried calling "ProcessDrawEvents" and "ProcessSystemEvents" but neither works.
0 Kudos
Message 1 of 3
(3,147 Views)
I'm assuming that what you mean by "discard data" is that you expect the previous plot to disappear. If so, that is not really the purpose of the "discard data" option. Its purpose is to save memory whenever users need to plot multiple, very large plots. It does this by freeing all the memory associated with each plot, and yet leaving it on the screen. The plots will only disappear from the screen whenever something happens that causes the axis range to change (such as, for example, plotting something in autoscale mode that sets a new min/max). Or they will go away when you cover up the graph, but only if the "smooth update" option is disabled.

There are other, more obscure ways of making these discarded plots disappear from the graph, but this doesn't sound as if
it's the option you're looking for, so you shouldn't use this option to begin with. It really is only intended to save memory.

If all you want is to "replace" one plot with the next so that you have only one plot visible at a time, you have to delete the old plot first. The function is DeleteGraphPlot. You can pass the plot handle that you got back from PlotWaveform, or if you know there's only one plot in there you can pass -1. Also, if you know you're going to add another plot as soon as you delete the old one, you should pass VAL_DELAYED_DRAW as the last parameter. This avoids double drawing, which would look like flashing.

Luis
NI
0 Kudos
Message 2 of 3
(3,147 Views)
Hi,
The "Discard Data" property of the graph is not a good way to refresh or delete plots in the graph; that property refers to the way the memory in handled for the graph.

When you plot data to a graph control using one of the plotting functions, the Discard Data property will cause a pointer to this data you passed to be maintained internally (crate a new copy). This does not means that any changes on this buffer will be reflected on the graph when it redrawn.

The only way to make sure that a plot is deleted is by using the DeleteGraphPlot(...) function. If you have multiple plots you can create an array of plot handles, and calls this function in a loop to delete all the plots. Use the Discard Data property just to manage how the memory
is used by the graph.

I hope this helps, let me know if you have further questions.

Regards,

Juan Carlos
N.I.
0 Kudos
Message 3 of 3
(3,147 Views)