Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
Objective Chart User's Guide
Rogue Wave web site:  Home Page  |  Main Documentation Page

8.6 Data Array Access

Chapter 3 detailed the general layout of the Objective Chart data array to be a two-dimensional, grid-like structure with numeric, stylistic, and text data storage. This section lists the functions available for accessing the data array.

To access an individual data object, reference it using its index and group coordinates.

If you reference a data list (group) or data object (index) that has not been created yet, Objective Chart automatically creates the necessary objects for you. Therefore, you can build and initialize your data array in one step. All you need to do is assign values to the groups and indices that you require. The SRGraphData and SRGraphDataList objects are created automatically and transparently. This capability to generate the data array is controlled by the growlist parameter of some of the access functions. Functions without this parameter generally do grow the data list if necessary. As noted below, some functions can not cause the data list to grow. If a non-existing data object is referenced by these functions (or others with growlist set to FALSE), an exception is thrown.

The SRGraph object has two sets of methods for this access. The first uses functions built in to the SRGraph class that allow indirect access to a data item. These functions are:

Greater control may be exercised over individual items in the data array by using the second set of data access methods. Functions within SRGraph return pointers to individual SRGraphDataList objects. Then functions within those objects give access to the SRGraphData items stored, also via pointers.

SRGraphDataList* 
SRGraph::GetGroup(int group, BOOL growlist)
SRGraphData* 
SRGraphDataList::GetIndex(int index, BOOL growlist)

These methods are commonly used in the following manner:

SRGraphData* 
SRGraph::GetData(int index, int group)
SRGraphData* 
SRGraph::GetSafeData(int index, int group)

GetGroup() and GetIndex() are used by the first set of data access functions. The SetXXX functions set the growlist parameter to TRUE, allowing the data list to grow. Therefore, you can build your data array without explicitly creating the data lists (SRGraphDataList) or data items (SRGraphData).

The following code segment builds a data array, including annotations and styles, for plotting two parabolas. For demonstration purposes, a variety of access methods are used.



Previous fileTop of DocumentContentsNo linkNext file

Copyright © Rogue Wave Software, Inc. All Rights Reserved.

The Rogue Wave name and logo, and Stingray, are registered trademarks of Rogue Wave Software. All other trademarks are the property of their respective owners.
Provide feedback to Rogue Wave about its documentation.