LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Deleting Plots

Please can anyone help?

 

I have an ATE program running many plots on many graphs onto multiple tabs, each tab may have up to 4 graphs, and each graph may have more than one trace.  This ATE program runs for several days, plotting results onto the appropriate tab and graph.  At the conclusion of the test run, I review the results, and if any plot shows an out-of-specification result, I make the necessary adjustments to the device under test, and then I want to delete the specific plot on that graph, and re-run the specific test for that plot.

The problem is in the deleting of the specific plot - not all the plots may need to be deleted. The DeleteGraphPlot function requires the ControlID, and the plot handle.   I have tried using the GetCtrlAttribute (tab_index, Main_Panel_Plots, ATTR_FIRST_PLOT, &first_plot); the GetCtrlAttribute (tab_index, Main_Panel_Plots, ATTR_NEXT_PLOTS, &next_plot); and the GetCtrlAttribute (tab_index, Main_Panel_Plots, ATTR_NUM_PLOTS, &total_plots); functions, but I do not know how to initially obtain the ControlID from (say) a mouse click on the desired graph, nor how to work out which of the several plots (i.e.. next_plot) on the graph correlates to the one I desire to delete.

Do I have to maintain an array of the plot handles, and populate a ring control(?) to give the user the selection of the plots to delete?  Or is there a way of using a mouse click on the specific graph - which would be amuch more user-friendly approach?

 

As always,

 

Thanks for any help

 

Allen Cherry

 

0 Kudos
Message 1 of 2
(2,765 Views)

Hi Allen,

 

as always, there are several possibilities...: Smiley Wink

 

For example you could maintain a global plot handle list, or a list for each graph control. Personally, I would treat each graph independently, i.e. for each graph control install a callback, i.e. in the UI editor type a unique function name for the callback function, e.g. Graph12Callback. This callback will be called only from events resulting from this control, hence you know the control id:

int CVICALLBACK Graph12Callback ( int panel_handle, int control_id, int event, void *callbackData, int eventData1, int eventData2 )

 

Now what is left is to find out the plot you want to select/delete. Here, too, several possibilities exist. For example, one could use graph cursors. Alternatively, as you have suggested, you could populate a ring control (which takes care only for one graph, so for every graph you have one ring): If you add a plot to a given graph, save the plot handle that is returned from a call such as plot_handle = PlotXY ( panel_handle, control_id,...); in a ring using InsertListItem ( panel_handle, ring_control, plot_index, , plot_handle );

 

A useful example provided with CVI is graphlegend.cws which demonstrates to select and delete one plot out of several plots.

 

Good luck,

 

Wolfgang

0 Kudos
Message 2 of 2
(2,760 Views)