XYRange::GetYColumn

Description

To get Y column of XYRange

Syntax

BOOL GetYColumn( Column & col, int nIndex = 0, int* pr1 = NULL, int* pr2 = NULL)

Parameters

col
[output]the Y column
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

EX1

There are times when you will want to know where the data for a plot is located. The following example shows how to get the workbook and worksheet names for the Y data in the active graph.

//Output the active graphlayer's source workbook name and worksheet name.
void XYRange_GetYColumn_Ex1()
{
    GraphLayer gl = Project.ActiveLayer();
    if( gl )
    {
        DataPlot dp = gl.DataPlots(0); // 0 = first plot
        if( dp )
        {
            XYRange xyr;
            if( dp.GetDataRange(xyr) )
            {
                Column col;
                if( xyr.GetYColumn(col, 0) ) // 0 = first Y data
                {
                    Worksheet wks;
                    col.GetParent(wks);
                    if( wks )
                    {
                        WorksheetPage wp;
                        wks.GetParent(wp);
                        if( wp )
                        {
                            printf("Workbook  = %s\n", wp.GetName());
                            printf("Worksheet = %s\n", wks.GetName());
                        }
                    }
                }
            }
        }
    }
}

Remark

See Also

XYRange::GetXColumn, XYRange::GetErrColumn

header to Include

origin.h