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

24.1 Sharing the Data Array

While it's possible to display multiple charts using separate SRGraph objects, using multiple display components in a single SRGraph object has advantages. It allows the displays to share a common background and title. As discussed in Section 24.3, components in the same SRGraph object can access each other's parameters. In addition, they access the same data array.

By default, the display component plots all the data available in the data array. Multiple display components all plot the same data. This can be useful for displaying the data using different graph types, but generally we want the displays to plot different variables from the data set.

To specify a subset of the data array to be plotted by a display:

  1. Call SRGraphComponent::SetScope().

    SetScope(int nMinIndex, int nMaxIndex, int nMinGroup, int nMaxGroup) specifies the rectangular subset of the data array to be plotted by the display. Setting a parameter to –1 indicates that the minimum or maximum available index or group is to be used. The scope must be a rectangular subset, so sharing of the data array may require careful planning and, in some cases, duplication of data objects.

  2. Call SRGraphStyle::SetRelIndex(TRUE).

    In most cases in which SetScope() is called, SetRelIndex(TRUE) should be called also. For charts that get their axis labels from the annotations of the first group of data objects, the relative index flag indicates that the annotations should come from the first group in the scope and not group 0.

The code below sets up two displays. The first display plots the data in groups 0 and 1. The second display plots group 2.



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.