LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

CWgraph adding and removing Y axes

Hi,

I'm using labwindows CVI 6.0, I need to do multiple plots, but its variable, so how can I remove and add Y axes ?

Thank you,
0 Kudos
Message 1 of 4
(3,129 Views)
There is a collection object in the instrument driver called CWAxes. You can use the Add and Remove functions of this collection object to Add or Remove axis. Then you will use the CWAxis functions to setup the Axis and assign Plot object to that axis.

For example, to add an axis would be something like:

CWUIControlsLib_CWAxesAdd (CWAxes, NULL, &CWNewAxis);

To remove the second axes in the collection it would be:

CWUIControlsLib_CWAxesRemove (CWAxes, NULL, CA_VariantInt(2));


Best Regards,

Chris Matthews
National Instruments
0 Kudos
Message 2 of 4
(3,129 Views)
Thank you for answering, by the way how do you associate axes colors to plot color in a CWGraph ?

I've found out how to add colors to a plot but the axes don't follow, is there a special type of plot that I have to select first ? or maybe when I will plot the axes will automatically change colors corresponding to the plot ?

Thank you,
0 Kudos
Message 3 of 4
(3,129 Views)
I'm assuming you are associating a plot color with an axis color programmatically. If so, then you need to follow two steps. Let's say we are dealing with axis number 2 (usually axis 2 is associated with the first Y-axis, axis 1 is the X-axis) and we want to change its color to red, since plot-1 is also red. Then, in Visual Basic it would be as follows:

CWGraph.Axes(2).Labels.Color = vbRed
CWGraph.Axes(2).Ticks.MajorTickColor = vbRed

In CVI, first you would get the CWLabels collection with function CWUI_CWAxisGetLabels(...) and then do a CWUI_CWLabelsSetColor(...) to Red.
Step number two would be to get the CWTicks with CWUI_CWAxisGetTicks(..) and then do a CWUI_CWTicksSetMajorTickColor(...) to red.

Note that we are coloring the labels of
the axis and also the ticks of the divisons on the axis. You don't have to color both. You can just color the labels and that would suffice.

Have fun coloring,

Azucena
NI
0 Kudos
Message 4 of 4
(3,129 Views)