From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

How to set major tick intevals in Component Works 2.0

I have some instructions that seem to indicate that I set tick marks in CW like this:

' specify that ticks are determined by MajorUnitsInterval
CWGraph1.Axes.Item(1).MajorDivisions = 0

' place major ticks every 2 units (even numbers)
CWGraph1.Axes.Item(1).MajorUnitsInterval = 2

' place minor ticks every .5 units
CWGraph1.Axes.Item(1).MajorUnitsInterval = .5

' the units base is 0
CWGraph1.Axes.Item(1).MajorUnitsBase = 0

' to specify ticks at odd numbers, change the base
' to 1
CWGraph1.Axes.Item(1).MajorUnitsBase = 1

However, my version of CW doesn't match that. Specifically, there are no variables in the VC++ pull down as described. About all I find when I pull down is this:

m_Settings
->m_Y_Axis.GetTicks().SetMajorUnitsBase( const VARIANT &v);

I have no instructions on this nor do I have any idea what to set in the VARIANT. Basically, what I want to do is to let the user change the graph's major units to 30 seconds, 20 minutes, etc.

HELP
John
0 Kudos
Message 1 of 3
(2,684 Views)
Hello

The help that you are seeing is related to CW 3.0 for Visual Basic, so it is relating how you would use the functions in Visual Basic. To find detailed help on using the graph object in VC, you should use the CW Components for C++, which provide custom made classes with make it easier to use all the NI ActiveX controls. You can use the Class wrappers generated by VC, but as you see already, they can be a little tough to use sometimes. So if you have the CW 3.0 Tools for C++, I would recommend using those rather than depending on the wrappers created by the VC class wizard.

To answer your question about using the wrapper classes to change the tick count, here is what worked for me

COleVariant myvar( (double)1);
m_graph.GetAxes().Item(_variant_
t((char *)"XAxis")).GetTicks().SetMajorDivisions(myvar);



This is how you would set the number of major divisions on the graph object. The process is the same for changing any other property of the graph.

So with CW Tools for Visual Basic, the help will only describe how to use the functions in Visual Basic, since the CW Tools for C++ provides its own functions, it does provide you with help for using these functions in VC. We do not have any help files for the wrappers that VC generates for the ActiveX controls

I hope this helps

Bilal Durrani
NI
Bilal Durrani
NI
Message 2 of 3
(2,684 Views)
Well, it wasn't the answer I wanted but it is accurate. THANKS
0 Kudos
Message 3 of 3
(2,684 Views)