![]() |
CNiAxes | ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Class |
Declared in: NiAxes.h |
Overview
A CNiAxes object is a collection of axes on a 2D graph control. This collection always contains one x axis and at least one y axis, although it may contain multiple y axes.
- Use the CNiGraph::Axes property to get the axis collection for the graph.
- Use the Add function to create additional y axes. Add returns a CNiAxis object, which represents the new axis.
- Use the Item function to access existing axes in the collection. You use this function to access axes by either name or index.
- Use the Remove function to remove existing axes from the collection. You use this function to access axes by either name or index. A COleException is thrown if you try to remove the x axis or the last y axis.
- Use the RemoveAll function to remove all optional y axes from the collection.
Base Classes
Data Items
![]() |
short | Count | The number of axes in the collection. |
Constructors
![]() |
CNiAxes() |
Default constructor. | |
![]() |
CNiAxes( CWAxes_CI* pCustom, CNiInterface::ThreadAccess option ) |
Constructor that attaches to the specified CWAxes_CI pointer. | |
![]() |
CNiAxes( const CNiAxes& source ) |
Copy constructor. |
Destructors
Functions
![]() |
CNiAxis | Add() |
Adds a new axis to the collection and returns the new axis. |
![]() |
static const IID & | GetIid() |
Returns the globally unique identifier (GUID) of the ActiveX interface to which this class connects. |
![]() |
CNiAxis | Item( long axisIndex ) |
Returns the specified axis from the collection. |
![]() |
CNiAxis | Returns the specified axis from the collection. | |
![]() |
const CNiAxes & | Assignment operator. | |
![]() |
void | Remove( long axisIndex ) |
Removes the specified axis from the collection. |
![]() |
void | Removes the specified axis from the collection. | |
![]() |
void | Removes all axes from the collection except for the default x and y axes. |
Examples
1. Set the caption and visibility of the x axis.
CNiGraph graph; CNiAxis xAxis = graph.Axes.Item("XAxis"); xAxis.Caption = "Temperature"; xAxis.Visible = true;
2. Set the range of the x axis on the graph from 0 to 100.
CNiGraph graph; graph.Axes.Item(1).SetMinMax(0, 100);
3. Add an additional y axis to the graph and set its caption.
CNiGraph graph; CNiAxis axis = graph.Axes.Add(); axis.Caption = "Power";
4. Remove all optional y axes.
CNiGraph graph; graph.Axes.RemoveAll();
5. Change the name of the x axis to "Time".
CNiGraph graph; graph.Axes.Item("XAxis").Name = "Time";
Subsequent attempts to access the X Axis must now use "Time" as the item name. For example,
graph.Axes.Item("Time").Visible = true;