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

18.9 Customizing a Compound Display

18.9.1 Changing the Formatting

To change the number of digits or add text for units, call SetFormatString() for the axis scale. For example,

or

18.9.2 Deriving Your Own Class for Custom Labels

To create non-uniformly spaced or other specific labels:

  1. Derive your own class from SRGDecimalScale and override CreateLabels() to generate labels however you want.

  2. Instantiate an object of your new scale class, configure it, and register it with the appropriate axis manager.

18.9.3 Avoiding Overlapping Labels

18.9.3.1 Setting Resolution of Axis Labels

To avoid overlapping or "too close together" labels, set the resolution of the axis labels. For numeric axes, the resolution value is the difference between label values in axis units. For index and group scales, the resolution is a skip factor (2=every other annotation is displayed).

or

Set SetCheckOverlaps(TRUE) for the label block in your setup of the scale component.

18.9.3.2 Hiding or Moving Overlapping Labels

You can choose to hide the overlapping labels or to move them. For example,

Alternatively, you can rotate the labels to 45 or 90 degrees to avoid overlap.

18.9.4 Adding a Title for the Y-Axis

To add a Y-Axis title, add an SRGraphLabel as a title for the YAxisA.

18.9.5 Creating a Chart with 2 Y-Axes

18.9.5.1 Chart with One Display but Two Y-Axes

To create a chart with one display but two y-axes showing different units of the same variable (like the CChart sample):

  1. Configure scales, tick marks, and grid lines (if desired) for both y-axes and at least one x-axis. (Only one axis should have a display component.)

  2. Specify that the axes are related.

  3. Define the relationship.

  4. a.

    If the relationship is a simple multiplicative conversion, use

    pCD->SetYRatio(1.0/25.4);

    b.

    If a more complex formula is required, use

    pCD->SetYRatio(0);

    to override CalcYRelationShip().

    This function accepts a value from the master (left) axis as a parameter and returns a value for the slave (right) axis.

18.9.5.2 Chart with Two Distinct Variable Types and Two Distinct Axes

To create a chart with two distinct variable types and two distinct axes:

  1. Configure both y-axes and one x-axis.

  2. a.

    Setup a display component for both y-axes. Of course, both displays must have similar styles. (In particular, they must have the same x-axis scale type and range.)

    b.

    Set the y-axis ranges, if desired.

  3. Set the data scope for each display. For example,

  4. Specify that the axes are not related (the default).

      pCD->SetYRelationship(FALSE);
      


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.