2.2.4.7.9 DataObjectBase::xInc

ClassName

DataObjectBase

AccessType

public

Name

xInc

Declaration

double xInc

Remark

Examples

EX1

// plot from nC1 to nC2 and make each plot
// to continue from the previous
// assume wks with data without X col, like WAV imports without Time col
void plotc(int nC2 = 1, int nC1 = 0)
{
    Worksheet wks = Project.ActiveLayer();
    if(!wks)
    {
        out_str("must run when wks is active");
        return;
    }
    
    GraphPage gp("MyPlot");
    if(!gp)
    {
        gp.Create("line");
        gp.Rename("MyPlot");
    }
    GraphLayer gl = gp.Layers(0);
    // first remove all data plots
    int nPlots = gl.DataPlots.Count();
    for(int ii = 0; ii < nPlots; ii++)
        gl.RemovePlot(0);
    
    double x1 = 0;
    double x2Last = 0;
    DataRange dr;
    for(int nC = nC1; nC <= nC2; nC++)
        dr.Add(wks, nC, "Y");
        
    int nPlot = gl.AddPlot(dr, IDM_PLOT_LINE);
    if(nPlot < 0)
        return; // error
    
    for(int cc = nC1, nn = nPlot; cc <= nC2; cc++, nn++)
    {    
        DataPlot dp = gl.DataPlots(nn);
        int nPts = dp.i2;
        if(0 == nn)
            dp.x0 = x1;
        else
            dp.x0 = x2Last; // connect to last data plot
        
        double xEnd = dp.x0 + dp.i2 * dp.xInc;
        x2Last = xEnd;
    }
    gl.Rescale();
}

Description

For Column or DataPlot that has been set with SetEvenSampling, the X increment

between each row. NANUM if not applicable.

Header to Include

origin.h

See Also

DataObjectBase::x0

Reference