This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Other Open Source Projects and the fly likes pie charts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "pie charts" Watch "pie charts" New topic
Author

pie charts

phani kon
Ranch Hand

Joined: Apr 06, 2005
Posts: 251
Hi,

Can anyone help me in this case?

I am working on pie charts using cewolf. I would like to know, Is there any way I can show the percentages on the lables of the pie chart.Please let me know, do you have any examples?


thanks a lot
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41634
    
  55
The labels are just strings - you can pass in whatever you can stuff into a string.


Ping & DNS - my free Android networking tools app
phani kon
Ranch Hand

Joined: Apr 06, 2005
Posts: 251
Could you please give me some examples for showing percentage on the lables like 73.45%.

Actually I am doing this code in the method DefaultPieDataset

dataset.setValue(sCategory[iCategory],s1);
//Here I am getting the values for s1 as 73.45 on the legend lables. I want show the legend lables as 73.45%
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41634
    
  55
Those labels are taken from the category - the first parameter of that method (which is a string, so it can contain any character you need).
phani kon
Ranch Hand

Joined: Apr 06, 2005
Posts: 251
By using the below code

dataset.setValue(sCategory[iCategory],s1);

I am getting the lables as ALL = 56.78 KIO = 67.89 so on

My question is, How would I change to ALL = 56.78% KIO = 67.89% and so on
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41634
    
  55
If you want the change just the labels -and not the categories-, then the easiest would be to use a custom label generator, something like this:

phani kon
Ranch Hand

Joined: Apr 06, 2005
Posts: 251
Thanks for your help. what do I have to write in my jsp page for the?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41634
    
  55
Are you using cewolf? If so, the easiest way would probably be to write a ChartPostProcessor.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: pie charts