Worksheet::GetCurve

Description

Create a curve object based on two datasets


Create a curve object from a dataset. The X data comes from the worksheet default or row index

Syntax

curvebase & GetCurve( int nColx, int nColy )

curvebase & GetCurve( int nColy )

Parameters

nColx
[input] Column (index from 0) to use as X data
nColy
[input] Column (index from 0) to use as Y data

nColy
[input] Column (index from 0) to use as Y data. Default X data is used.

Return

A reference to the curvebase class object.


A reference to the curvebase class object.

Examples

EX1

// Create a worksheet with sample data and an empty graph
// Then plot the X vs. the Y 
void Worksheet_GetCurve_Ex1()
{
    Worksheet wks;
    GraphPage gp;
    gp.Create("line.otp", CREATE_VISIBLE);
    wks.Create("origin.otw",CREATE_VISIBLE); // Newly created worksheet is active
    LT_execute("col(1)=data(1,30);col(2)=normal(30)*4+3;");
    curvebase& crv = wks.GetCurve(1, 0); // Note how the designation is the reverse of the default XY designation
    GraphLayer gl;
    gl = gp.Layers(0);
    gl.AddPlot(crv);
}


EX2

// Create a worksheet with sample data and an empty graph
// Then plot the Y data in the graph
void Worksheet_GetCurve_Ex2()
{
    Worksheet wks;
    wks.Create("origin.otw",CREATE_VISIBLE); // Newly created worksheet is active
    LT_execute("col(1)=data(1,30);col(2)=normal(30)*4+3;");
    curvebase& crv = wks.GetCurve(1);
    
    GraphPage gp;
    gp.Create("line.otp", CREATE_VISIBLE);
    GraphLayer gl = gp.Layers(0);
    gl.AddPlot(crv);
}

Remark

See Also

header to Include

origin.h