apex:legend

Defines a chart legend. This component offers additional configuration options beyond the defaults used by the legend attribute of the <apex:chart> component.

Note: This component must be enclosed within an <apex:chart> component.

Example 

1<!-- Page: -->
2<apex:chart height="400" width="700" data="{!data}">
3    <apex:legend position="right"/>
4    <apex:axis type="Numeric" position="left" fields="data1,data2"
5        title="Opportunities Closed" grid="true"/>
6    <apex:axis type="Category" position="bottom" fields="name"
7        title="Month of the Year"/>
8    <apex:lineSeries title="Closed-Won" axis="left" xField="name" yField="data1"/>
9    <apex:lineSeries title="Closed-Lost" axis="left" xField="name" yField="data2"/>
10</apex:chart>

Attributes 

Attribute NameAttribute TypeDescriptionRequired?API VersionAccess
fontStringThe font to be used for the legend text, as a CSS-style font definition. If not specified, this value defaults to “12px Helvetica”. 23.0
idStringAn identifier that allows the chart component to be referenced by other components on the page. 23.0global
paddingIntegerThe amount of spacing between the legend border and the contents of the legend, in pixels. 23.0
positionStringThe position of the legend, in relation to the chart. Valid options are: left, right, top, or bottomYes23.0
renderedBooleanA Boolean value that specifies whether the chart legend is rendered with the chart. If not specified, this value defaults to true. 23.0
spacingIntegerThe amount of spacing between legend items, in pixels. 23.0

See Also