Label overlaps in LegendTitle object

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
thomas31
Posts: 1
Joined: Wed Oct 20, 2010 2:18 pm
antibot: No, of course not.

Label overlaps in LegendTitle object

Post by thomas31 » Wed Oct 20, 2010 2:55 pm

Hi,

I am using JFreeChart 1.0.9 and see labels that overlap in the LegendTitle objects on Mac OS X but not on Linux. Same code for both setups. Not sure if this issue is related to the version of JFreeChart I am using or not? Anyway I cannot change mine.

My code makes 2 charts. Both are made of a CombinedDomainXYPlot that embeds 2 TimeSeriesCollections with 1 TimeSeries per collection. The legend is automatically generated (I set the boolean flag of the legend to true in the constructor).

Here is what it looks like on Linux (Ubuntu): http://www.turboimagehost.com/p/4583878 ... x.png.html

And here is what it looks like on Mac OS X: http://www.turboimagehost.com/p/4583877 ... x.png.html

For the chart on top (EMIF1 Bandwith (MB/s)) I force the padding between labels by calling:

Code: Select all

mEmif1Chart.getLegend().setItemLabelPadding(new RectangleInsets(2.0, 10.0, 2.0, 10.0));


For the chart at the bottom (EMIF2 Bandwidth (MB/s)), I do nothing. On Linux everything is OK, but on Mac OS X, as you can see:
1. the frame border overlaps the second test label
2. the graphic anchor of the second text label overlaps the first text label

I use the following code to set the font of the LegendTitle:

Code: Select all

awtFont = (SWTUtils.toAwtFont(parent.getDisplay(), parent.getFont().getFontData()[0], true)).deriveFont(11f);
mEmif1Chart.getLegend().setItemFont(awtFont);
mEmif2Chart.getLegend().setItemFont(awtFont);
What do you think the issue is coming from? What's the solution?

Thanks you for your help.

Best regards.

Thomas.

Locked