Developing with the SDK > Using and Adding Renderers > Predefined Renderers > The Legend Renderer

The Legend renderer displays a legend box explaining the look of the graphic objects. The legend is generated using an index property. For each object, the value of the index property is queried. If no object with the same value is already shown in the legend, a new entry is added.

Each entry consists of a copy of the graphic object and a label displaying the value of the property for this graphic object.

The legend can be contained in the same view as the generated graph, or it can be in a separate frame.

The legend can contain several columns, each corresponding to a different index property.

The graphic objects in the legend can be customized separately, using the pseudoclass legend. For example, shows how to set the same color for all the links in the legend.

link:legend {
   foreground : "green";
}

Code Sample 4.21 Setting a Color for the Links in the Legend

Table 4.18 lists the properties of the Legend renderer.

Table 4.18 Global Properties of the Legend Renderer 
Property 
Type 
Default 
Description 
background 
Color 
white 
The background color of the legend box. 
checkBoxesVisible 
boolean 
true 
If true, each entry has a check box that lets the user show or hide the corresponding graphic objects. 
foreground 
Color 
black 
The border color of the legend box. 
indexProperty 
String 
null 
Specifies the object property to use as an index. You can specify several properties, separated by commas. Each index property will be displayed in a separate column of the legend. 
inlaid 
boolean 
true 
If true, the legend box is contained in the diagram. Otherwise, it is displayed in a separate frame. 
insideMargin 
int 
The margin around the legend elements. 
labelFont 
Font 

 
The font used for the labels of the entries. 
labelsZoomable 
boolean 
false 
Specifies whether the labels must be zoomable. 
layer 
int 
30 
The manager layer in which the legend box will be added. 
legendVisible 
boolean 
true 
Hides or shows the legend. 
legendZooming 
boolean 
true if inlaid, false if not inlaid 
If true, the legend items zoom together with the view. If false, the legend items do not zoom; they always keep the same size when the diagram is zoomed in or out. 
linksLength 
float[] 
50 
The length of links in each column of the legend. 
linksWidth 
float[] 
The width of links in each column of the legend. Zero means the same width as in the diagram. 
maxEntries 
int 
10 
The maximum number of entries for each column. 
outsideMargin 
int 
The margin around the legend. 
position 
int 
BottomLeft 
The position where the legend will be placed in the diagram. 
scrollDelay 
int 
200 
The delay (in milliseconds) before showing the legend after scrolling the diagram. 
sortingEntries 
boolean 
true 
If true, the legend entries are sorted alphabetically. If false, the entries appear in the same order as in the data model. 
spacing 
int 
The spacing between the elements of the legend. 
title 
String 
null 
Specifies the title(s) of the column(s). You can pass several values, separated by commas. 
titleFont 
Font 

 
The font used for the titles of the columns. 
updateOnPropertyChange 
boolean 
false 
If true, the legend is dynamically updated when a property of an object changes in the data model. 
xOffset 
float 
The horizontal offset of the legend relative to the border of the diagram. 
yOffset 
float 
The vertical offset of the legend relative to the border of the diagram. 

The Legend renderer does not define any per-object rendering properties.

See the class ilog.views.sdm.renderer.IlvLegendRenderer for more details.