Centering the labels of the legend when too long

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
SimOOn
Posts: 10
Joined: Wed Aug 27, 2008 9:44 am
Contact:

Centering the labels of the legend when too long

Post by SimOOn » Thu Nov 27, 2008 2:37 pm

When the labels of my legend are too long and can't fit on a single line, they aren't not centered any more.

Example :
Image

Is there a solution to solve this or is it a bug ?

SimOOn
Posts: 10
Joined: Wed Aug 27, 2008 9:44 am
Contact:

Post by SimOOn » Mon Dec 01, 2008 1:01 pm

I have been looking for a solution to make it work in the documentation and in the API but I haven't been able to solve that problem.

Has anyone an idea to fix it ?
Thanks a lot.

iogan18tm
Posts: 24
Joined: Tue May 04, 2004 5:14 pm

Post by iogan18tm » Fri Dec 05, 2008 4:42 pm

Alas, this is not a solution but a workaround.
You can move labels a little with this code

Code: Select all

chart.getLegend().setPadding(new RectangleInsets(UnitType.RELATIVE,0,0.1,0,0));

Locked