| 2.2.4.17.5 GraphLayer::AddXErrBarAddXErrBar
 DescriptionAdds an X error bar plot to an existing dataplot.
 Syntaxint AddXErrBar( Curve & cData, Column & colXErrBar ) 
 int AddXErrBar( Curve & cData, Dataset & dsXErrBar ) Parameters cData[input] Data curve to add the X error bar to colXErrBar[input] the Data curve to be used as X error bar
 
  cData[input] Data curve to add the X error bar to dsXErrBar[input] the dataset to be used as X error bar
 Returnthe index of the the added X error bar dataplot in layer, or -1 if failed.
 ExamplesEX1
 // For this example to run, a worksheet with columns "A" and "B" and another column
// (the third column) must exist with some numeric data in them. 
// After the function executes, the third column of the worksheet will be used
// for X error bars (the graph may need to be refreshed to see the error bars).
void    GraphLayer_AddXErrBar_ex1()
{
    GraphPage gp;
    gp.Create();
    GraphLayer    lay = gp.Layers(0);
 
    // a dataplot in the layer that uses column B as Y and column A as X
    Worksheet wks = Project.WorksheetPages(0).Layers(0);
    if(lay && wks)
    {
        Curve            cc(wks, 0, 1);
        lay.AddPlot(cc);
 
        // use the third column in the worksheet for X error bar:
        Column    colErrBar(wks, 2);        
        int                nPlotIndex = lay.AddXErrBar(cc, colErrBar);
        lay.Rescale();
        out_int("nPlotIndex = ", nPlotIndex);
    }
}EX2
 //For this example to run, a worksheet with columns "A" and 
//"B" and "C" must exist with some numeric data in them. 
//After the function executes, the graph may need to be 
//refreshed to see the error bars.
void Graphlayer_AddXErrBar_ex2()
{
    Worksheet wks = Project.WorksheetPages(0).Layers(0);
    GraphPage gp;
    gp.Create("origin");    
    GraphLayer glMyLayer = gp.Layers(0);
 
    if(wks && glMyLayer)
    {
        Curve crvMyCurve(wks, 0, 1);
        glMyLayer.AddPlot(crvMyCurve);
        Dataset dsXErrBar(wks, 2);
        int iPlotIndex = glMyLayer.AddXErrBar(crvMyCurve, dsXErrBar);
        glMyLayer.Rescale();
        if (iPlotIndex==-1)
            printf("X ErrBar Plotting Error!");
        else
            printf("X Errbar added successfully!");
    }
}RemarkSee AlsoHeader to Includeorigin.h
 |