displaying percentage in pie chart upto 2 decimal places

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
kapilsharma
Posts: 5
Joined: Thu Oct 25, 2007 4:29 pm
Location: India
Contact:

displaying percentage in pie chart upto 2 decimal places

Post by kapilsharma » Wed Jan 09, 2008 11:11 am

hi all,
I am not able set my pie chart to display percentage upto 2 decimal places. So I have 0.2% or 0.3% displayed as 0%.
Is there any specific setting that I can use to configure and display decimal values in pie chart?

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Post by david.gilbert » Wed Jan 09, 2008 11:50 am

You can call setLabelGenerator() in the PiePlot class to control the section label format. If you use the StandardPieSectionLabelGenerator class, this constructor gives you control over the percentage formatting:

Code: Select all

public StandardPieSectionLabelGenerator(String labelFormat,
            NumberFormat numberFormat, NumberFormat percentFormat);
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

Locked