How do you place a footer (subtitle) below the legend?
How do you place a footer (subtitle) below the legend?
I'm trying to put a footer in my charts by adding a subtitle, but even when I set the vertical alignment to BOTTOM, the legend still shows below the subtitle. Is there any work around? If not, can anyone point me in the right direction in the JFreeChart package? TIA.
Actually I set the position. The vertical alignment did nothing:
Code: Select all
footer.setPosition(RectangleEdge.BOTTOM);
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
The legend is also a chart subtitle. JFreeChart will draw the subtitles in order, from the outside of the chart working inwards (once the titles are drawn, whatever space is left is allocated to the plot).
So you need to create a chart with no legend, add your subtitle first, then add the legend.
So you need to create a chart with no legend, add your subtitle first, then add the legend.
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader


Hello jusepi,
Can you explain about the same bit more expandedly?
Thanks & Regards,
muthu
Can you explain about the same bit more expandedly?
Thanks & Regards,
muthu
jusepi wrote:Actually I set the position. The vertical alignment did nothing:
Code: Select all
footer.setPosition(RectangleEdge.BOTTOM);
Nothing seemed to work until i set the legend to false when I create the chart and add the subtitle (footer) before I add the legend. The following code seems to create the same exact legend as the default:
You still need to set the footer position...
Code: Select all
LegendTitle legend = new LegendTitle(plot);
legend.setPosition(RectangleEdge.BOTTOM);
legend.setBorder(new BlockBorder());
legend.setBackgroundPaint(Color.white);
chart.addLegend(legend);
Code: Select all
footer.setPosition(RectangleEdge.BOTTOM);