Legend Parameters

All NetCharts applets, except for NFDiagramApp, support the display of a legend on the right-hand side of the chart. The entries for the legend can be fully specified, or can be loaded automatically using the names and colors assigned to all data sets being displayed.

Legend definitions are specified using the following parameters:

Legend      = (Label Tuple);
LegendBox   = (Region Tuple);
LegendItems = (Legend Item Tuple1), (Legend Item Tuple2), ...;
If the Legend parameter is defined, then the legend will be displayed, using the given label attributes for each of the labels in the legend. If the Legend label string attribute (the first attribute in the Label tuple) is not equal to "" or "OFF", then it will be displayed as a title at the top of the legend. If the label attribute is set to "OFF", then the legend will not be displayed. This allows a dynamic update server to disable a legend that was previously enabled. See Label Parameters for more details about label attributes.

The LegendBox parameter is optional. If specified, it defines a box to be displayed as a background for the legend. The box will be automatically scaled to fit all tbe legend items. See Region Parameters for more details about region attributes.

The LegendItems parameter is optional. If specified, it defines all of the items to be included in the Legend, with the following attributes for each tuple:

"Label"    - Item label to be displayed
Color      - Item color to be displayed
SymType    - Symbol Type (NONE, CIRCLE, SQUARE, DIAMOND, CROSS,
                          TRIANGLEDOWN, TRIANGLEUP)
SymSize    - Symbol Size (in pixels)
SymStyle   - Symbol Style (FILLED, OUTLINED)
LineType   - Line Type (NONE, SOLID, DOTTED, DASHED, DOTDASH)
LineWidth  - Line Width (in pixels)
LineColor  - Line Color
If the LegendItems parameter is not defined, then the list of items will be constructed based on the color and labels assigned to the data sets in the current chart.

If the Color attribute is not defined or is set to "null", then a default color will be selected from the color table. See NFColor for more details about color specification.

If the SymType attribute is defined, then the given symbol will be drawn, with the given SymSize and SymStyle next to the item label. If no SymType is defined, a box is drawn. Also, if SymSize is set to 0, the default, the symbol will be sized to fit the font size of the item label.

If the SymType atrribute is set to NONE, the default, and the LineType attribute is not NONE, then a line will be drawn next to the item label, using the given LineWidth and LineColor.

Examples

In this example, a default legend is displayed without a box, using the colors and labels from the datasets.

Legend = ("", black, "TimesRoman", 16);

In this example, a legend is displayed, with a given title and a background region, using the default labels and colors from that data sets.

Legend    = ("My Legend", black, "Courier", 18);
LegendBox = (yellow, SHADOW, 5);

In this example, a legend is displayed, with a given title and a background region, using a custom defined set of item labels, colors and symbols.

Legend      = ("My Legend", black, "Courier", 18);
LegendBox   = (yellow, SHADOW, 5);
LegendItems = ("Group 1"),
              ("Group 34", red, CROSS),
              ("Group 8", null, NONE, 0, FILLED, DOTTED, 3, orange);