DataObjectBase::SetRange

Description

It sets the data (display) range for the object.

Syntax

BOOL SetRange( int i1 = SETRANGE_FULL, int i2 = SETRANGE_FULL, BOOL bRepaint = TRUE )

Parameters

i1
[input] the lower bound of the desired range, zero offset.
i2
[input] the upper bound of the desired range, zero offset.
bRepaint
[input] TRUE to repaint the object after changing the range, FALSE not to repaint.

Return

TRUE for success, FALSE for failure.

Examples

EX1

// After the function executes, the data plot will show
// only the data points from 5 to 10.
void    DataObjectBase_SetRange_ex1()
{
    Worksheet wks;
    wks.Create("origin");
    Dataset ds1(wks,0);
    Dataset ds2(wks,1);
    ds1.Data(1,20,1);
    ds2.Normal(20);
    GraphPage gp;
    gp.Create("origin");
    GraphLayer gl(gp.GetName(), 0);
    gl.AddPlot(wks);

    if(gl)
    {            
        // Get the first data plot in the layer:
        DataPlot        dp = gl.DataPlots(0);
    
        // Change the display range of the data plot to
        // show only points from 5 to 10: (1 offset)
        dp.SetRange(4, 9);
    }
}

Remark

It sets the data (display) range for the object. Not that this range can be smaller than the total range of data of the underlying dataset if not all data values are shown. For example, in case of a data plot in a graph, some data points may not have been plotted. Predefined values for i1 and i2 are:

SETRANGE_UNCHANGED - leaves corresponding value unchanged

SETRANGE_FULL - use full dataset range. Use this value to turn Autorange on for DataPlots.

See Also

DataObjectBase::GetRange

Header to Include

origin.h