Legend Key Style

The default key style is CX_KEY_AUTOMATIC. With this style, the legend uses the graph type and the style of the individual data objects to determine whether to draw a line, wiget, or box for the key.

To change this default behavior, call SRGraphStyle::SetLegendKeyStyle() using one of the following styles to specify the type of key displayed.

Legend key style

Legend key style

Description

CX_KEY_NONE

No key is shown.

CX_KEY_AUTOMATIC

A best guess is made to display a key in a style consistent with the legend’s current context.

CX_KEY_LINE

A line is drawn next to the text.

CX_KEY_BOX

A box is drawn.

CX_KEY_WIGET

A wiget is drawn.

CX_KEY_DATA

The key style is determined by the style object in the data item — call SetLegendKeyStyle() for each data item.

CX_KEY_CUSTOM

User defined — override DrawCustomKey()

To hide the line normally drawn with a wiget, call SRGraphStyle::SetLegendLine(FALSE).

To exercise maximum control on the appearance of individual keys:

  • Call SetLegendKeyStyle(CX_KEY_DATA) for the legend's style.

  • Call SetLegendKeyStyle() on the style of the individual data objects to change their representation.