ChartDirector 6.0 (C++ Edition)



void addKey(const char *text, int color, int lineWidth = 0, const DrawArea *drawarea = 0);


Adds a custom entry to the legend box.

This method adds an entry within a legend entry priority of 1 (followed by 2, 3, 4, ... for repeated calls). This has higher priority than entries added automatically by ChartDirector for representing data sets. As a result, by default, the custom entry will appear before the automatic entries.

To control the order of the custom entry relative to the automatic entries, use LegendBox.addKey2.

See LegendBox for more information on legend entry priority system.


text(Mandatory)The text of the legend entry.
color(Mandatory)The icon color of the legend entry.
lineWidth0The line width for legend entry that represents lines in line charts.
drawarea[Null]A DrawArea containing the data symbol represents the legend entry. This is primarily used for legend entries in line charts with data symbols, or in scatter charts.

Return Value