add_curve_to_graph_layer

 

Description

It adds the curve cuv to the layer grl.

Syntax

bool add_curve_to_graph_layer( curvebase & cuv, GraphLayer & grl, int nColor = 2, bool bRescale = false, int nPlotType = IDM_PLOT_LINE )

Parameters

cuv
[input] the input curve
grl
[input] the layer to add the curve to.
nColor
[input] the color the curve should have.
bRescale
[input] to rescale the layer with the curve or not.
nPlotType
[input] the plot type of the curve to add.

Return

TRUE if OK, otherwise FALSE.

Examples

EX1

//This example add the data of the specified column to the first layer of the current Graph.
void add_curve_to_graph_layer_ex1()
{
    WorksheetPage wksPage = Project.WorksheetPages(0);
    Worksheet wks = wksPage.Layers(0);
    if(wks)
    {
        Curve crvPlotted( wks, 1 );
        GraphPage gp;
        gp.Create("ORIGIN");
        GraphLayer gl = gp.Layers(0);
        if(crvPlotted && gl)
        {   
            int nColor = SYSCOLOR_BLUE;
            bool bRescale = true;
            int nPlotType = IDM_PLOT_SCATTER;
            bool bOK = add_curve_to_graph_layer(crvPlotted, gl, nColor, bRescale, nPlotType);
            string strGrp = gp.GetName();
            string strCrv = crvPlotted.GetName();
            if(bOK)
            { 
                out_str(strCrv+" exists in "+strGrp);
            }
            else
            {
                out_str(strCrv+" does not exist in "+strGrp);
            }
        }
    }
}

Remark

See Also

header to Include

origin.h

Reference