CNiPlots

CNi

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

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

CNiPlots encapsulates the interface to the Plots property of a CNiGraph object, which allows you to access and remove plots associated with the graph control.

  • Use the CNiGraph::Plots property to obtain the plots collection for the graph.
  • Use the Add function to create additional plots. Add returns a CNiPlot object, which represents the new plot.
  • Use the Item function to access existing plots in the collection. This function can access plots by either name or index.
  • Use the Remove function to remove existing plots from the collection. This function can access plots by either name or index.
  • Use the RemoveAll function to remove all plots from the graph.

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 Returns the number of plots in the collection.

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

Public constructor

CNiPlots()

Default constructor.
Public constructor

CNiPlots( CWPlots_CI* pCustom, CNiInterface::ThreadAccess option )

Constructor that attaches to the specified CWPlots_CI pointer.
Public constructor

CNiPlots( const CNiPlots& source )

Copy constructor.

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

Public destructor

~CNiPlots()

Destructor.

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

Public function CNiPlot

Add()

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

GetIid()

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

Item( long plotIndex )

Returns the specified plot from the collection.
Public function CNiPlot

Item( const CString& plotName )

Returns the specified plot from the collection.
Public function const CNiPlots &

operator =( const CNiPlots& source )

Assignment operator.
Public function void

Remove( long plotIndex )

Removes the specified plot from the collection.
Public function void

Remove( const CString& plotName )

Removes the specified plot from the collection.
Public function void

RemoveAll()

Removes all plots from the collection.

Shortcut to top of page. Examples

1. Set the first plot in the graph to auto scale.

    CNiGraph graph;
    CNiPlot plot = graph.Plots.Item(1);
    plot.AutoScale = true;

2. Set the point style on the first plot in the graph.

    CNiGraph graph;
    graph.Plots.Item(1).PointStyle = CNiPlot::PointAsterisk;

3. Add a new plot to the graph.

    CNiGraph graph;
    CNiPlot plot = graph.Plots.Add();
    plot.FillToBase = true;

4. Remove all plots from the graph.

    CNiGraph graph;
    graph.Plots.RemoveAll();

5. Change the name of the first plot to "Velocity".

    CNiGraph graph;
    graph.Plots.Item(1).Name = "Velocity";

Subsequent accesses to the plot must now use "Velocity" as the item name. For example,

    graph.Plots.Item("Velocity").Visible = true;