XYRange::GetPlot

Description

Get a dataplot generated from this datarange

Syntax

BOOL        GetPlot(DataPlot& dp, int nIndex = 0, int* pr1 = NULL, int* pr2 = NULL)

Parameters

dp
[output]the DataPlot object
nIndex
[input]the data index
pr1
[output]if not NULL, will get row range
pr2
[output]if not NULL, will get row range

Return

TRUE if success

Examples

//Get a dataplot generated from XYRange dr.
void XYRange_GetPlot_Ex1()
{
        //assume the active workbook a sheet and has least two columns before run this code.
        Worksheet wks = Project.ActiveLayer();
        if ( !wks )
        {
                printf("Can not find any active worksheet!");
                return;
        }
        XYRange dr;
        dr.Add("X", wks, 0, 0, -1, 0);
        dr.Add("Y", wks, 0, 1, -1, 1);
        GraphPage gp;
        gp.Create("origin");
        GraphLayer gl = gp.Layers(0);
        if ( !gl )
        {
                printf("Can not get a graphlayer!");
                return;
        }
        gl.CheckShowActivate();
        uint nCntrl = GAP_USE_TEMPLATE | GAP_ALLOW_DUPLICATE_COL;
        gl.AddPlot(dr, IDM_PLOT_SCATTER, nCntrl);
        gl.Rescale();
        DataPlot dp;
        dr.GetPlot(dp);
        return;
}

Remark

See Also

DataRange::GetPlots, XYRange::MakePlot

header to Include

origin.h