Focal Point
Pie Chart Slice Color

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/6911021171

June 08, 2006, 08:56 AM
kalyanswarna
Pie Chart Slice Color
Hi all
i have Some Doubts in my Pie Chart.here my Requirement is i want to do each slice having differenet color. i want to put my custom colors on each slice. i want API for this.



Thanks
Kalyan
June 08, 2006, 09:18 AM
Pam Kratt
You would put the following commands within your graphstyle I believe:

ON GRAPH SET GRAPHSTYLE *
setFillColor(getSeries(0),new Color(0,0,255)); blue
setFillColor(getSeries(1),new Color(0 255 0)); lime green
setFillColor(getSeries(2),new Color(255,0,255)); fuscia
setFillColor(getSeries(3),new Color(255,255,0)); yellow
setFillColor(getSeries(4),new Color(0,255,255)); aqua
setFillColor(getSeries(5),new Color(50,153,204)); sky blue
setFillColor(getSeries(6),new Color(255,0,0)); red

To determine colors, Susannah has created a document that is called Excel Colorname Key – What Is "Indian Red," Anyway (works for graphs). You can find this as you go into focal point in the developer center in the focus on developers section. Hope this helps.


webfocus 8.105M; os: windows; pdf, html, exl2k, csv
June 08, 2006, 10:58 AM
EJL
To keep our colors consistent we put the setFillColor lines (about 20 of them) into a file on the WF Client server and put an include statement in our pie charts.

"setTemplateFile("/images/tdg/template/MALFillColors.txt");"

That also has the advantage of being able to change the colors for all the reports in one place if at some point the users decide they think your shade of yellow is just too bright.
November 14, 2006, 03:57 PM
isjhb
What do you do to prevent having 2 slices that are the same color next to each other. If you have 8 slices of pie there will be 2 the same color. Is there a way to prevent this.

This message has been edited. Last edited by: isjhb,
November 15, 2006, 06:41 PM
BlueZone
I second the suggestions from Pam & EJL.

We have the following piece of graph color stylesheet commands in a member by itself and
-INCLUDE this member in the stylesheet area of the fex, whenever we generate graphs (Bar or Pie).

ON TABLE SET STYLE *
-INCLUDE OURSTYLE
-*-* other local S-S commands
ENDSTYLE


setFillColor(getSeries(0), new Color(0,0,255));
setFillColor(getSeries(1), new Color(0,255,0));
setFillColor(getSeries(2), new Color(255,0,255));
setFillColor(getSeries(3), new Color(255,255,0));
setFillColor(getSeries(4), new Color(255,0,0));
setFillColor(getSeries(5), new Color(255,165,0));
setFillColor(getSeries(6), new Color(255,192,203));
setFillColor(getSeries(7), new Color(0,255,255));
setFillColor(getSeries(8), new Color(206,0,54));
setFillColor(getSeries(9), new Color(255,239,0));
setFillColor(getSeries(10), new Color(0,152,82));

You could play around with the color palette and come up with your own RGB values. This example gives you 11 custom colors. If you need more, you just keep repeating the lines with an ascending getSeries(xx) value and new RGBs.
Hope that helps !!
Sandeep.

This message has been edited. Last edited by: BlueZone,


-------------------------------------------------------------------------------------------------
Blue Cross & Blue Shield of MS
WF.76-10 on (WS2003 + WebSphere) / EDA on z/OS + DB2 + MS-SQL
MRE, BID, Dev. Studio, Self-Service apps & a dash of fun !! Music