want to change color in piechart

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

want to change color in piechart

Post by Ram karthik » Thu Aug 25, 2005 8:46 am

hi
I am using 3dpiechart in my application, i want to change colors in that as per my requirement ,Is it possible to do that , please say how to do that .


bye

Ram

chad

Post by chad » Thu Aug 25, 2005 5:43 pm

PiePlot plot = (PiePlot) chart.getPlot();
plot.setSectionPaint(sectionNum,paint);


Hope this helps

Ram Karthik

want to change color

Post by Ram Karthik » Mon Aug 29, 2005 10:50 am

Thanks for your suggestion ,

but am using this method
" ChartFactory.createPieChart3D " only and am passing five arguments which are title,dataset and three bollean values , can you suggest me that what i have to do to change the color , can i call some other methods or can i change the jar files . please help me


bye

Ram

Ram karthik

Post by Ram karthik » Mon Aug 29, 2005 5:59 pm

Thak you

The color changed Successfully,i need another help too, i want to get % with the values ,currently am getting just 65 but i want to get 65%
please help me.

bye
Ram

pmlb
Posts: 31
Joined: Thu Aug 25, 2005 5:18 pm
Location: France

Post by pmlb » Mon Aug 29, 2005 8:55 pm

Build your own label format using StandardPieItemLabelGenerator and forward it to the PiePlot:

Code: Select all

PiePlot plot = (PiePlot) chart.getPlot();
PieSectionLabelGenerator gen = new StandardPieItemLabelGenerator("{0}={2}%");
plot.setLabelGenerator(gen);
Pierre-Marie

Ram karthik

Post by Ram karthik » Wed Aug 31, 2005 2:02 pm

Thanks ,
i got the value as 75% instead of 75 in piechart,now i want to display the legend without value ,please help me to do this one also

bye
Ram karthik

pmlb
Posts: 31
Joined: Thu Aug 25, 2005 5:18 pm
Location: France

Post by pmlb » Wed Aug 31, 2005 2:40 pm

I guess you could use the setLegendLabelGenerator method of the plot in the same way.
Pierre-Marie

Ram karthik

Post by Ram karthik » Thu Sep 01, 2005 12:28 pm

Thank You once again

by using setLegendLabelGenerator method i can get the label without value ,i want to get a label in pie and differant label in legend , is it possible
please suggest me

by
Ram Karthik

pmlb
Posts: 31
Joined: Thu Aug 25, 2005 5:18 pm
Location: France

Post by pmlb » Thu Sep 01, 2005 1:49 pm

As written previously:

setLabelGenerator for lthe pie section label
setLegendLabelGenerator for the legend

build the format you need for each of them using StandardPieItemLabelGenerator class (different format if you want different label)
Pierre-Marie

Ram Karthik

Post by Ram Karthik » Fri Sep 02, 2005 8:24 am

Thank you very much i got what i required

bye

Ram karthik

Locked