2.1.5.3 curve_duplicate_active


Description

duplicate the active curve in the active graph layer so that analysis routine like derivatives and smoothing can be performed on the copied curve

Syntax

curvebase & curve_duplicate_active( LPCSTR lpcszNewColName = NULL, bool bReuseIfInWks = false )

Parameters

lpcszNewColName
[input] name of the Y column for the copied curve
bReuseIfInWks
[input] option to always create new copy of can reuse if named column is already in the same worksheet as the original

Return

NULL if no active graph layer with active curve found, or if the operation failed

Examples

EX1

//This example copy the active curve with the data of column B from the Graph.
void curve_duplicate_active_ex1()
{
    WorksheetPage wksPage = Project.WorksheetPages(0);
    Worksheet wks = wksPage.Layers(0);
    if(wks)
    {        
        GraphPage  gp;
        gp.Create();
        GraphLayer gl = gp.Layers(0);
        
        Curve crv(wks, 1);
        if(crv && gl)
        {
            add_curve_to_graph_layer(crv, gl);            // add the curve to the graphlayer
            gl.Rescale();
            
           	set_active_layer(gl);                     // set the graphlayer to active
           	gp.Refresh();           		  // need do refresh after set acitve	
            
            // get curve from active graph layer to copy
            curvebase& crvCopy = curve_duplicate_active();
            if(crvCopy != NULL)
            {
                out_str("Copy successfully.");
            }
        }
    }
}

Remark

See Also

Header to Include

origin.h

Reference