ChartDirector 6.0 (C++ Edition)

BaseChart.addLegend


Usage

LegendBox *addLegend(int x, int y, bool vertical = true, const char *font = 0, double fontSize = 10);

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.
verticaltrueA true value means the legend keys are laid out vertically (one line per entry). A false 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.