section color of pie chart

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
sweta jaiswal
Posts: 6
Joined: Tue Apr 24, 2007 12:16 pm

section color of pie chart

Post by sweta jaiswal » Tue Apr 24, 2007 12:19 pm

how can we customize section color 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 » Tue Apr 24, 2007 1:50 pm

Use the setSectionPaint() method.
David Gilbert
JFreeChart Project Leader

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

sweta jaiswal
Posts: 6
Joined: Tue Apr 24, 2007 12:16 pm

section color of pie chart

Post by sweta jaiswal » Tue Apr 24, 2007 2:03 pm

is there any way to implement array or list of n colors for sections?

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 » Tue Apr 24, 2007 2:08 pm

Do you mean something like this?

Code: Select all

        Color[] colours = new Color[] {Color.red, Color.green, Color.blue};
        for (int i = 0; i < colours.length; i++) {
            plot.setSectionPaint(i, colours[i]);
        }
David Gilbert
JFreeChart Project Leader

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

sweta jaiswal
Posts: 6
Joined: Tue Apr 24, 2007 12:16 pm

Post by sweta jaiswal » Tue Apr 24, 2007 2:18 pm

yup, something like this, but is it possible to to make a generic class with has a list of colors, as i need to 20-25 different colors

Locked