CNiAxes

CNi

Class CNiAxes Base ClassesData ItemsConstructorsDestructorsFunctionsGo to hierarchy chart    Prev page: RemoveAllNext page: Count    
Class Declared in:
NiAxes.h

'Overview' icon -- Shortcut to top of page. 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.

Hierarchy Chart Hierarchy Chart

'Base Classes' icon -- Shortcut to top of page. Base Classes

'Data Items' icon -- Shortcut to top of page. Data Items

Public data short Count The number of axes in the collection.

'Constructors' icon -- Shortcut to top of page. Constructors

Public constructor

CNiAxes()

Default constructor.
Public constructor

CNiAxes( CWAxes_CI* pCustom, CNiInterface::ThreadAccess option )

Constructor that attaches to the specified CWAxes_CI pointer.
Public constructor

CNiAxes( const CNiAxes& source )

Copy constructor.

'Destructors' icon -- Shortcut to top of page. Destructors

Public destructor

~CNiAxes()

Destructor.

'Functions' icon -- Shortcut to top of page. Functions

Public function CNiAxis

Add()

Adds a new axis to the collection and returns the new axis.
Public function static const IID &

GetIid()

Returns the globally unique identifier (GUID) of the ActiveX interface to which this class connects.
Public function CNiAxis

Item( long axisIndex )

Returns the specified axis from the collection.
Public function CNiAxis

Item( const CString& axisName )

Returns the specified axis from the collection.
Public function const CNiAxes &

operator =( const CNiAxes& source )

Assignment operator.
Public function void

Remove( long axisIndex )

Removes the specified axis from the collection.
Public function void

Remove( const CString& axisName )

Removes the specified axis from the collection.
Public function void

RemoveAll()

Removes all axes from the collection except for the default x and y axes.

Shortcut to top of page. 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;