LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

cwgraph clear data

Hi folks!

I wrote this code in order to clear all plot data in my cwbraph object.

It seems does not working properly. Is there something wrong?

    CAObjHandle ObjHandle;        // Handle for activeX control
   
    GetObjHandleFromActiveXCtrl (panel, control, &ObjHandle);
    CWUIControlsLib__DCWGraphClearData(ObjHandle, NULL);
   
    CA_DiscardObjHandle(ObjHandle);   

Thank you in advance.
0 Kudos
Message 1 of 4
(3,496 Views)
Hi Oliveira,
 
The code looks okay to me... How are you plotting the data in the first place?
 
This is what mine looks like, where:
PANEL_CWGRAPH is the constant name for my CWGraph
 
 
int CVICALLBACK ButtonPlot (int panel, int control, int event,
  void *callbackData, int eventData1, int eventData2)
{                 
 VARIANT myVariant;
 CAObjHandle ObjHandle;        // Handle for activeX control  
 double values[5] = {1,3,2,5,4};
  
 CA_VariantSet1DArray (&myVariant, CAVT_DOUBLE, 5, values);
 
 switch (event)
 {
  case EVENT_COMMIT:
   GetObjHandleFromActiveXCtrl (panelHandle, PANEL_CWGRAPH, &ObjHandle);
   CWUIControlsLib__DCWGraphPlotY (ObjHandle, NULL, myVariant, CA_DEFAULT_VAL, CA_DEFAULT_VAL, CA_DEFAULT_VAL);
   break;
  case EVENT_RIGHT_CLICK:
   break;
 }
 return 0;
}
 
int CVICALLBACK ButtonClear (int panel, int control, int event,
  void *callbackData, int eventData1, int eventData2)
{
 CAObjHandle ObjHandle;        // Handle for activeX control
 
 switch (event)
 {
  case EVENT_COMMIT:
   GetObjHandleFromActiveXCtrl (panelHandle, PANEL_CWGRAPH, &ObjHandle);
      CWUIControlsLib__DCWGraphClearData(ObjHandle, NULL);
   
      CA_DiscardObjHandle(ObjHandle);
   break;
  case EVENT_RIGHT_CLICK:
   break;
 }
 return 0;
}
Jervin Justin
NI TestStand Product Manager
0 Kudos
Message 2 of 4
(3,473 Views)
Hi Jervin!

I plotted the graph using this command:

CWUIControlsLib__DCWGraphChartXvsY( p_objActiveXHandle, NULL, CA_VariantDouble (p_dblTimeToPlot), m_varDataToPlotY, CA_VariantBool(0) );

This command is in while loop and when the user clicks on one button I need to restart the graph. I got the click event, but when it is executed the clear command, nothing apparently occurs.

Regards.
0 Kudos
Message 3 of 4
(3,467 Views)
I use the refresh command and now it works properly.

Thank you for your help.


Message Edited by Oliveira on 04-04-2008 11:45 AM
0 Kudos
Message 4 of 4
(3,461 Views)