Legends II, the return...

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

Legends II, the return...

Post by Jerome » Thu Jun 20, 2002 1:21 pm

Is it possible to change the text of each legend ? How can i do this ? For example, i wan't to draw a piechart and put the % for every parts of the piechart.
Is it possible to add it directly IN the piechart ?

David Gilbert

Re: Legends II, the return...

Post by David Gilbert » Thu Jun 20, 2002 2:48 pm

In a pie chart the legend (if visible) displays the category names from the dataset. For now, the only way to change the text is to change the category names.

The labels on the pie sections can use several formats, see the setSectionLabelType(...) method in the PiePlot class.

--> NO_LABELS
--> NAME_LABELS
--> VALUE_LABELS
--> PERCENT_LABELS
--> NAME_AND_VALUE_LABELS
--> NAME_AND_PERCENT_LABELS
--> VALUE_AND_PERCENT_LABELS

At the moment, the label positioning is fixed "outside" the pie...you could change that by overriding the calculateLabelPosition method.

Regards,

DG.

Locked