curvebase::Append

Description

Append data from a vector or Dataset object to this Origin C Curve object and update the related Origin Worksheet or Graph window from this Origin C Curve object.

Syntax

BOOL Append(vector& v, int iMode = REDRAW_NONE)

Parameters

v
[input] vector or Dataset to append
iMode
[input] Dataset update mode, allowed values are
REDRAW_NONE do update
REDRAW_REALTIME graph realtime drawing, only the new added data will be drawn
REDRAW_REALTIME_WKS similar to REDRAW_REALTIME_SCOPE, but redraw the entire worksheet
REDRAW_REFRESH do a simple refresh of the data
REDRAW_REALTIME_SCOPE this is used to do realtime drawing for the entire range of data. To see effect in plots, must set dataplots to animate mode

Return

Returns TRUE on successful exit and FALSE on failure.

Examples

EX1

//Can test with either a worksheet of data or a graph window with at least one plot
int curvebase_Append_ex1(int npts)
{
    PageBase pbTemp;
    pbTemp = Project.Pages(); // Get the project's active page
    Curve aa,bb;
    vector a(npts);
    vector b(npts);
    static int nn = 1;
    switch( pbTemp.GetType() )
    {
        case EXIST_WKS:
            Worksheet wks(Project.ActiveLayer());            
            aa.Attach(wks,0);
            bb.Attach(wks,1);
            break;
        case EXIST_PLOT:  
            GraphLayer    gl = Project.ActiveLayer(); // Get active layer in project file
            if(gl)                                  // If valid graph layer...
            {
                DataPlot dp = gl.DataPlots(0);      // Get first data plot in graph layer
                if(dp)                              // If valid DataPlot...
                {
                    Curve crv(dp);                  // Get Curve from DataPlot
                    string dsXName;
                    crv.HasX(dsXName);
                    aa.Attach(dsXName);
                    bb.Attach(dp.GetDatasetName());
                }
            }                    
            break;
        default:
            printf("Active window is not worksheet or graph.");
    }
    for(int ii = 0; ii < npts; ii++)
    {
        a[ii] = nn++;
        b[ii] = rnd();
    }
    aa.Append(a, REDRAW_REALTIME);
    bb.Append(b, REDRAW_REALTIME);
    return 0;
}

Remark

See Also

vectorbase::Append, curvebase::Update

header to Include

origin.h