Charts > Using the Charts Library > Decorations Display > Displaying a Legend > Adding a Legend to a Chart
 
Adding a Legend to a Chart
A chart legend object is added to a chart by means of the IlvChartGraphic::setLegend method. When the legend is set on the chart, the legend items corresponding to the displayers that are defined in the chart are computed automatically and added to the legend (if the property “Automatically Recomputed” has its default value IlvTrue) and the size of the legend is recomputed to fit these legend items (if the property “Automatically Fit to Contents” has its default value IlvTrue).
For an example of how to create and add a legend to a chart, see Adding a Legend in the chapter “Chart Basics.”
Note: The chart legend object is a graphic object just like the chart object and is positioned independently of the chart object. Therefore, when you add the chart object to the container or manager that contains it, do not forget to add the chart legend object to this container or manager as well. Otherwise, the chart legend object will not appear on the screen.

Version 6.1
Copyright © 2016, Rogue Wave Software, Inc. All Rights Reserved.