ChartDirector 5.1 (PHP Edition)

BaseChart.addLegend


Usage

addLegend(x, y [, vertical [, font [, fontSize ]]])

Description

Adds a legend box to the chart.

The entries in the legend box will flow from top to bottom (one line per entry), or from left to right and then top to bottom (like flowing text), depending on the vertical argument. For grid layout, use BaseChart.addLegend2.

Arguments

ArgumentDefaultDescription
x(Mandatory)The x coordinate of the reference point of the legend box. By default, the reference point is the top-left corner of the box, but can be configured by using TextBox.setAlignment.
y(Mandatory)The y coordinate of the reference point of the legend box. By default, the reference point is the top-left corner of the box, but can be configured by using TextBox.setAlignment.
verticaltrue (non-zero)A true (non-zero) value means the legend keys are laid out vertically (one line per entry). A false (zero) value means the legend keys are laid out horizontal and flow like text (from left to right, top to bottom).
font""The font name of the font for drawing the legend text. The default is "normal". See Font Specification for details on various font attributes.
fontSize10The font size of the legend text.

Return Value

A LegendBox object representing the legend box. You may use this object to fine-tune the appearance of the legend box.