03-10-2009 08:34 AM
I am using LabWindows CVi 6.0. I'm a part time programmer. I have developed a small application to acquire data and plot using PlotXY() function. I have to acquire data from 6 pressure transducer equipments and then plot 2 parameters for each equipment. I'm not able to refresh (clear or delete) the previous traces of plot, when I select new parameters to plot. I use a timer to update plotXY function. I have ListBox to select equipment. I tried many options for Plot in GUI, DeleteGraph() function still not successful.
Peice of code which I used during my app development attached below. Am I missing something here?..
// Function to select Equipment/Parameters
int plotIdWt=0, plotIdLR=0;
int CVICALLBACK PlotDataFunctionCB (int panel, int control, int event, void *callbackData, int eventData1, int eventData2)
{
unsigned long int Tcount=0;
switch (event)
{
case EVENT_COMMIT:
GetCtrlVal (panel, PLOTPANEL_EQUIPMENT, &plot_ctrlVal);
SetCtrlAttribute (panel, PLOTPANEL_TIMER01, ATTR_ENABLED, 0); // Disable Timer
SetCtrlAttribute (panel, PLOTPANEL_PLOT, ATTR_DATA_MODE, VAL_DISCARD);
DeleteGraphPlot (panel, PLOTPANEL_PLOT, plotIdLR, VAL_DELAYED_DRAW);
DeleteGraphPlot (panel, PLOTPANEL_PLOT, plotIdWt, VAL_DELAYED_DRAW);
//RefreshGraph (panel, PLOTPANEL_PLOT);
plotIdWt = plotIdLR = 0;
SetCtrlAttribute (panel, PLOTPANEL_TIMER01, ATTR_ENABLED, 1); // enable Timer
//MessagePopup("Message", "plotting Data complete");
break;
}
return 0;
}
int CVICALLBACK CallPlotTimeFunction (int panel, int control, int event, void *callbackData, int eventData1, int eventData2)
{
switch (event)
{
case EVENT_TIMER_TICK:
SetCtrlAttribute (panel, PLOTPANEL_PLOT, ATTR_DATA_MODE, VAL_RETAIN);
plotIdWt = PlotXY (panel, PLOTPANEL_PLOT, timeA, PTR_WtArray[plot_ctrlVal-1], timeCount,VAL_DOUBLE, VAL_DOUBLE, VAL_CONNECTED_POINTS,VAL_ASTERISK, VAL_SOLID, 1, VAL_DK_GREEN);
//SetPlotAttribute (panel, PLOTPANEL_PLOT, plotIdLR, ATTR_PLOT_YAXIS, VAL_RIGHT_YAXIS);
plotIdLR = PlotXY (panel, PLOTPANEL_PLOT, timeA,PTR_LRArray[plot_ctrlVal-1], timeCount, VAL_DOUBLE,VAL_DOUBLE, VAL_CONNECTED_POINTS, VAL_ASTERISK,VAL_SOLID, 1, VAL_DK_BLUE);
SetPlotAttribute (panel, PLOTPANEL_PLOT, plotIdWt, ATTR_PLOT_YAXIS, VAL_LEFT_YAXIS);
SetCtrlAttribute (panel, PLOTPANEL_PLOT, ATTR_DATA_MODE, VAL_DISCARD);
break;
}
return 0;
}
Thanks & Regards,
Joy Gomes.
03-11-2009 01:01 AM
03-11-2009 05:43 AM
Thanks for valuable suggestion. I shall try.
Regards,
Joy Gomes.