Newer Version Available
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 Name | Attribute Type | Description | Required? | API Version | Access |
|---|---|---|---|---|---|
| font | String | The 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 | ||
| id | String | An identifier that allows the chart component to be referenced by other components on the page. | 23.0 | global | |
| padding | Integer | The amount of spacing between the legend border and the contents of the legend, in pixels. | 23.0 | ||
| position | String |
The position of the legend, in relation to the chart. Valid options are:
|
Yes | 23.0 | |
| rendered | Boolean | A Boolean value that specifies whether the chart legend is rendered with the chart. If not specified, this value defaults to true. | 23.0 | ||
| spacing | Integer | The amount of spacing between legend items, in pixels. | 23.0 |