/*LabelBlock titleBlock = new LabelBlock("Legend Items:",
new Font("SansSerif", Font.BOLD, 12));
titleBlock.setPadding(5, 5, 5, 5);
wrapper.add(titleBlock, RectangleEdge.TOP);*/
LegendTitle legend = new LegendTitle(chart.getPlot());
BlockContainer items = legend.getItemContainer();
if(styleLegend!=null && styleLegend.getFont()!=null){
legend.setItemFont(new Font(styleLegend.getFontName(), Font.BOLD, styleLegend.getSize()));
}
items.setPadding(2, 5, 5, 2);
wrapper.add(items);
legend.setWrapper(wrapper);
if(legendPosition.equalsIgnoreCase("bottom")) legend.setPosition(RectangleEdge.BOTTOM);
else if(legendPosition.equalsIgnoreCase("left")) legend.setPosition(RectangleEdge.LEFT);
else if(legendPosition.equalsIgnoreCase("right")) legend.setPosition(RectangleEdge.RIGHT);
else if(legendPosition.equalsIgnoreCase("top")) legend.setPosition(RectangleEdge.TOP);
else legend.setPosition(RectangleEdge.BOTTOM);
legend.setHorizontalAlignment(HorizontalAlignment.CENTER);
chart.addSubtitle(legend);
}