I am trying to align the legend below a XY Linegraph with the extents of the axis of the graph. Currently my code looks like this:
Code: Select all
LegendTitle legend = new LegendTitle(chart.getPlot());
BlockContainer wrapper = new BlockContainer(new BorderArrangement());
wrapper.setBorder(new BlockBorder(1.0, 1.0, 1.0, 1.0));
BlockContainer items = legend.getItemContainer();
items.setPadding(2, 10, 5, 2);
wrapper.add(items);
legend.setWrapper(wrapper);
legend.setPosition(RectangleEdge.BOTTOM);
legend.setHorizontalAlignment(HorizontalAlignment.CENTER);
chart.addSubtitle(legend);
How can I set position and extent of the Legend?
Thanks in advance.