Legends are used to map certain colors or symbols to their respective series. A Chart can have multiple Legends. If the first Series added to the Chart's PlotArea does not already have a Legend then a legend will be automatically created and added to the Chart's LegendList. If the Chart's Auto Layout property is true, the Legends will visually occupy 35% of the Chart width. If Chart's AutoLayout property is set to false then the Legend's X, Y, Width and Height properties should be set manually to control the placement of the Legend. A Legend can either be accessed through the Chart that it belongs to or through the Series that belongs to that Legend.
To create a new legend the following code can be used:
[Java]
Legend legend = chart.getLegends().add();
[Java]
Legend legend = chart.getLegends().getLegend(0);
legend.setBackgroundColor(RgbColor.getGreenYellow();