How to avoid line break in (pie section) label?

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
mhilpert
Posts: 497
Joined: Wed Apr 02, 2003 1:57 pm
Location: Germany

How to avoid line break in (pie section) label?

Post by mhilpert » Fri Apr 01, 2005 10:06 am

COmpared to old JFreeChart 0.9.13, in 1.0.0-pre-2 the text for pie plot section labels get broken into multiple lines if it contains spaces. E.g. "{0} ({2})" results in

Code: Select all

Label1
(42%)
instead of

Code: Select all

Label1 (42%)
Is there a way to avoid this automatic line break?
Java 11, JFreeChart 1.0.15, JFreeSVG 4.0

timw
Posts: 20
Joined: Fri Mar 18, 2005 12:36 pm
Location: London

Post by timw » Fri Apr 01, 2005 1:25 pm

I'm using 1.0.0-pre-2 and i tried replicating your problem using the following but it works fine for me:

Code: Select all

plot.setLabelGenerator(new StandardPieSectionLabelGenerator ("{0} ({2})" , new DecimalFormat("0.0"),new DecimalFormat("0.0")));
This gives the Label on one line with spaces e.g. One (0.3). Can u post a sample application we can run which shows this problem?

mhilpert
Posts: 497
Joined: Wed Apr 02, 2003 1:57 pm
Location: Germany

Post by mhilpert » Fri Apr 01, 2005 1:56 pm

Perhaps this only occurs with PieCHarts. We have PieCharts of about 200x150 dimension and the labels are "EUR (23%)", "USD (48%)", etc. As you can see the labels are quite small, but still line break with smaller PieCharts.
Java 11, JFreeChart 1.0.15, JFreeSVG 4.0

Locked