LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I programatically change the min and max values of the x- and y-axis in a CWGraph using LabWindows/CVI?

Hello,

I am a beginner when it comes to the CWGraph control and am struggling with the code needed to programatically change the min and max values of the CWGraph axes in LabWindows. This is the only feature of the graph I need to change via a user interface. Has anyone figured out how to program this feature and can offer me some quick assistance?

Thanks in advance.

Randy
0 Kudos
Message 1 of 2
(3,024 Views)
Hello Randy,

In order to programatically change the min and max values of the axes of a CWGraph before you have plotted to it, you must:

1. Get a handle to the axes of the graph.
CWUIControlsLib__DCWGraphGetAxes (objectHandle, NULL, &axesHandle);
2. Get a handle to the Y axes.
CWUIControlsLib_CWAxesItem (axesHandle, NULL, CA_VariantInt(1),&axisYHandle);
3. Get a handle to the X axes.
CWUIControlsLib_CWAxesItem (axesHandle, NULL, CA_VariantInt(2),&axisXHandle);
4. Set the minimum/maximum of the X and Y axes.
CWUIControlsLib_CWAxisSetMinMax (axisXHandle, NULL, CA_VariantInt(xMin), CA_VariantInt(xMax));
CWUIControlsLib_CWAxisSetMinMax (axisYHandle, NULL, CA_VariantInt(yMin), CA_VariantInt(yMax));

Where the constants are declared as:

int xMin, yMin, xMax, yMax;
CAObjHandle objectHandle;
CWUIControlsLibObj_CWAxis axisYHandle, axisXHandle;
CWUIControlsLibObj_CWAxes axesHandle;

Hope that helps.
Wendy L
LabWindows/CVI Developer Newsletter
0 Kudos
Message 2 of 2
(3,004 Views)