Menu

#800 Horizontal alignment legend items after newline is incorrect

1.0.x
open
nobody
General (896)
5
2012-11-27
2007-10-11
No

When the legend is rendered on the right side of the chart, the legend labels are rendered left-aligned. This is the case for the first lines of the labels, when they exist out of more than one line (using \n in the label), every other second line of the label is center-aligned.

An easy fix would be:

org.jfree.chart.block.LegendBlock.java#draw(Graphics2D g2, Rectangle2D area, Object params)

Add the following line:

this.label.setLineAlignment(HorizontalAlignment.LEFT);

I do not know if this would have consequences to the legend if it is rendered at the bottom.

Discussion


Log in to post a comment.