GraphLayer::DataPlots

Description

The Collection property of all Dataplots in the graph layer.


Access one dataplot in graph layer by index


Access one dataplot in graph layer by name

Syntax

Collection<DataPlot> DataPlots

DataPlot DataPlots(int index = -1)

DataPlot DataPlots(LPCSTR lpcszName)

Parameters

index
[input] data plot index with zero offset (-1 means the active data plot). default is -1.

lpcszName
[input] the name of data plot

Return

A DataPlot.

Examples

EX1

//Change the display range of the data plots in the graph layer to show only points from 3 to 5.
/*Run following LT command before run the code
fn$= system.path.program$ + "Samples\Graphing\Group.dat";
impASC fn$; 
worksheet -s 2 0 4 0;
plotxy;
*/
void    GraphLayer_DataPlots_ex1()
{
    GraphLayer gl = Project.ActiveLayer();       
 
    // Loop over all the dataplots in the collection:    
    foreach (DataPlot dp in gl.DataPlots)
    {
        // Change the display range of the data plot to show only points from 3 to 5:
        dp.SetRange(3, 5);
    }
}

EX2

/*Run the LT command before run the code
fn$= system.path.program$ + "Samples\Graphing\Group.dat";
impASC fn$; 
worksheet -s 2 0 4 0;
plotxy;*/
//Use index to access the dataplot
void    GraphLayer_DataPlots_ex2()
{
        GraphLayer gl = Project.ActiveLayer();       
        DataPlot   dp;

        // Get the second dataplot in the layer:
        dp = gl.DataPlots(1);

        // Show the points from 3 to 5:
        dp.SetRange(3, 5);
}

EX3

/*Run the LT command before run the code
fn$= system.path.program$ + "Samples\Graphing\Group.dat";
impASC fn$; 
worksheet -s 2 0 4 0;
plotxy;*/
//Use the name to access dataplot
void    GraphLayer_DataPlots_ex3()
{
        GraphLayer gl = Project.ActiveLayer();       
        DataPlot   dp;
        string strName = gl.DataPlots(0).GetName();// Get the first dataplot name in the layer

        dp = gl.DataPlots(strName);

        // Show the points from 3 to 5:
        dp.SetRange(3, 5);
}

Remark

See Also

header to Include

origin.h