DataRange::GetSubRange

Description

Get one subrange.

Syntax

BOOL GetSubRange( const vector<uint> & vPath, DataRange & SubRange, BOOL bCol = true )

BOOL GetSubRange( DataRange & SubRange, DWORD dwRules, int indexData = 0 )

Parameters

vPath
[input]
SubRange
[output]
bCol
[input]

SubRange
[output]The Datarange that receives the datarange
dwRules
[input]the rules for extracting data from DRR_ enumeration.
indexData
[input]

Return

Examples

EX1

// This example prints out the minimum and maximum X and Y values in all existing
// XY selections of the active worksheet or graph
void DataRange_GetSubRange_Ex1()
{
   Tree trXYSelection;
   DWORD dwRules = DRR_GET_DEPENDENT | DRR_NO_FACTORS;
   init_input_data_branch_from_selection(trXYSelection, dwRules);
   //    out_tree(trXYSelection);

   DataRange dr, drSub;
   dr.Create(trXYSelection, false);

   DWORD dwPlotID; // This is to retrieve DataPlot UID if present
   vector vX, vY;
   double xmin, xmax, ymin, ymax;
   string strRange;
   int nNumData = dr.GetNumData(dwRules);
   for( int nIndex = 0; nIndex < nNumData; nIndex++ )
   {
        // Copy data associated with nIndex of dr into vectors using DataRange::GetData
        dr.GetData( dwRules, nIndex, &dwPlotID, NULL, &vY, &vX);
        dr.GetSubRange(drSub, dwRules, nIndex);
        drSub.GetData( dwRules, nIndex, &dwPlotID, NULL, &vY, &vX);
        // Now we have made a copy of XY data into vectors vX and vY
        // so we can do analysis on the data...for example:
        vX.GetMinMax(xmin, xmax);
        vY.GetMinMax(ymin, ymax);
        strRange = drSub.GetDescription();
        printf("%s\nxmin = %g\nxmax = %g\nymin = %g\nymax = %g\n", strRange, xmin, xmax, ymin, ymax);
   }
}

Remark

See Also

DataRange::GetRange

header to Include

origin.h