quick pie chart query

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
james hart

quick pie chart query

Post by james hart » Tue Mar 19, 2002 4:20 pm

Hi,
I would be grateful if anyone could tell me if it is possible to arrange the labels at the bottom of a pie chart and key code them - like with a bar chart. Or alternativly if there is any way to make the labels wrap on to another line.

I have a pie chart with long labels and this currently means the jpeg has to be really wide or the labels are cut off.

thanks in advance,
James Hart.

David Gilbert

Re: quick pie chart query

Post by David Gilbert » Tue Mar 19, 2002 5:36 pm

Hi James,

If you create your pie chart using the ChartFactory class, you should notice there is a flag controlling whether or not you want a legend on the chart...set this to true.

Then you need to change the pie chart label type - there is a method in the PiePlot class that controls this: setSectionLabelType(int). You probably want NO_LABELS or PERCENT_LABELS.

Regards,

Dave Gilbert

Locked