Chapter Contents


SAS/AF Software: Class Dictionary

Displaying a Legend in a Chart Control

To display a legend in a Chart control, set the showLegend attribute to Yes. For the legend to display, you must be using a color variable in the graph to represent a response variable's values.

For a control named chart1, the following code displays a legend:

/* varName is the color variable's name */

There are two types of legends: bar and list. Use the legendType attribute to specify either a Bar or a List legend:
Bar Represents colors as a bar of graduated colors. Available when the colorSource attribute is set to colorList or colorRangeObject.
List Lists the color used to represent each value from the response variable. Available only if the colorSource attribute is set to colorRangeObject.

The information displayed for the legend depends on the legend's size. If the size is large enough to display legend values and labels without overlap, the values and labels are displayed. If the legend size is too small to display the values or labels, they are automatically hidden so that the legend does not look cluttered.

Scrolling a Legend

If the legendType is List and a legend's current size isn't large enough to display all legend values, you can scroll the legend values interactively. To do so, position the mouse pointer within the legend's border. When the pointer shape changes to a four-headed arrow, click in the legend and drag the mouse up or down to scroll to the desired values.

Moving and Sizing a Legend Interactively

You can interactively move a legend or change its size. To do so, you must set the showLegend attribute to Yes, and the actionMode attribute to Legend.

To move the legend, position the mouse pointer over the legend's border. When the pointer shape changes to a hand, click and drag the legend to the desired location within the Pie control's border.

To change the legend's size, use the sizing lines, which are located on each side of the legend's border. Position the mouse pointer over one of the sizing lines. When the pointer shape changes to a double-headed arrow, click and drag the border in the appropriate direction to enlarge or reduce its size. For example, to make the legend taller, drag the top border up.

Chapter Contents



Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.