DataRange::DataRange

Description

Default constructor for the DataRange class.

Syntax

DataRange( )

Parameters

Return

Examples

EX1

//This example construct a datarange with a block, a whole row and a whole col.
//Then set each ranges as a treenode of a tree and output the tree.
//Destroy the datarange and costruct a new datarange with treenodes.
void DataRange_DataRange_Ex1()
{
    DataRange dr; // Default constructor
    double rr;
    Worksheet wks;
    wks.Create("Origin");
 
    if( wks )
    {
        while(wks.Columns(0))
            wks.DeleteCol(0);
 
        wks.AddCol("A");
        wks.AddCol("B");
        wks.AddCol("C");
        for(int i=0;i<3;i++)
        {
          for(int j=0;j<10;j++)
              {   
                rr=rnd();
                wks.SetCell(j, i, 100*rr);
              }
        }
        dr.Add("Range1", wks, 0, 0, 1, 1);  // A block
        dr.Add("Range2", wks, 3, 0, 3, -1); // A whole row ( row 4) 
        dr.Add("Range3", wks, 0, 2, -1, 2); // A whole col (column C)
 
        Tree tr;
        TreeNode trDataRange = tree_check_get_node(tr, IMPTREE_NODE_DATA_RANGE);
        dr.GetTree(trDataRange);
        dr.Destroy();
        out_tree(trDataRange);
 
        DataRange dr2; // Default constructor
        bool bret = dr2.Create(trDataRange);
        if(!bret)
                out_str("Fail to construct a Datarange!");
    }
}

Remark

Default constructor for the DataRange class. The DataRange class is a versatile mechanism for getting, setting, and passing data between Origin C functions.

See Also

Curve::Curve, XYRange::XYRange

header to Include

origin.h