LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Plot data is lost or corrupted when plotting new data with autoscale enabled

When plotting XY data from a thread other than the UI thread, previously plotted data is lost or corrupted whenever the new data causes the plot scale to change. Seems OK if autoscale is disabled or when plotting from the UI thread. A small example project is attached.
0 Kudos
Message 1 of 4
(2,906 Views)
Yes this is the correct behavior because you have not set up your graph to keep a copy of the original plot data. Therefore, when it is rescaled, the original data is not available to redraw. We give you this option for performance reasons in case you don't want our graph taking up memory with the original plot data. The problem will go away if you check the "Copy Original Plot Data" in the graph control settings, or programmatically it's:

SetCtrlAttribute (handle, PANEL_GRAPH, ATTR_COPY_ORIGINAL_DATA, 1);

Best Regards,

Chris Matthews
National Instruments
Message 2 of 4
(2,906 Views)
Thanks, this indeed cured my problem. I'm puzzled though. In the example project, the original plot disappears when a new plot causes rescaling. However, if at any point after that the same scale is in effect twice in a row, the original data reappears. (If you just let the example run, the original data appears from time to time.) So it is not clear how any memory is saved.
0 Kudos
Message 3 of 4
(2,906 Views)
Yes, the graphics aren't gone since you are in retain mode, but the original data is gone so replotting at a different scale doesn't work.

Chris
0 Kudos
Message 4 of 4
(2,906 Views)