Focal Point
[Solved]Colors for each slice in PIE graph

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

February 03, 2012, 10:30 AM
SriAravind
[Solved]Colors for each slice in PIE graph
I have a pie graph in which i'm mentioning the colors for each slice.
But I'm not getting the mentioned color for only one of the slice.

Here is the sample code:

GRAPH FILE CAR
SUM DEALER_COST AS ''
BY CAR
WHERE CAR EQ 'BMW' OR 'MASERATI' OR 'JAGUAR'
HEADING CENTER
"Car Pie Graph"

ON GRAPH PCHOLD FORMAT PNG
ON GRAPH SET HTMLENCODE ON
ON GRAPH SET GRAPHDEFAULT OFF
ON GRAPH SET VZERO OFF
ON GRAPH SET HAXIS 200
ON GRAPH SET VAXIS 200
ON GRAPH SET UNITS PIXELS
ON GRAPH SET LOOKGRAPH PIESINGL
ON GRAPH SET GRMERGE ADVANCED
ON GRAPH SET GRMULTIGRAPH 0
ON GRAPH SET GRLEGEND 1
ON GRAPH SET GRXAXIS 0
ON GRAPH SET GRAPHSTYLE *
setReportParsingErrors(false);
setSelectionEnableMove(false);
setDepthRadius(5);
setTransparentBorderColor(getSeries(0),true);
setTransparentBorderColor(getSeries(1),true);
setTransparentBorderColor(getSeries(2),true);
setTransparentBorderColor(getSeries(3),true);
setPieDepth(10);
setPlace(true);
setPieLabelDisplay(3);
setDisplay(getLegendArea(),false);
setOtherPieLabelDisplay(3);
setFontName(getTitle(),"SansSerif");
setFillColor(getTitle(),new Color(32,0,32));
setFontStyle(getTitle(),2);
setFontSizeAbsolute(getTitle(),true);
setFontSizeInPoints(getTitle(),10);
setPlaceResize(getTitle(),0);
setTextWrap(getPieLabel(),true);
setGradientDirection(getSeries(0),9);
setFillType(getSeries(0),1);
setFillColor(getSeries(1),new Color(#FFFF00));
setFillColor(getSeries(2),new Color(#0000FF));
setFillColor(getSeries(3),new Color(#008000));
setFontSizeAbsolute(getPieSliceLabel(),true);
setFontSizeInPoints(getPieSliceLabel(),8);
setPlaceResize(getPieSliceLabel(),0);
setFontSizeAbsolute(getPieLabel(),true);
setFontSizeInPoints(getPieLabel(),8);
setPlaceResize(getPieLabel(),0);
setFillColor(getSeries(0),new Color(118,101,188));
setFontStyle(getPieSliceLabel(),0);
setFontStyle(getPieLabel(),0);
setTransparentBorderColor(getChartBackground(),false);
setPieFeelerTextDisplay(1);
setRect(getPieFrame(),new Rectangle(-15520.0,-13672.0,36373.0,26084.0));
setTextString(getSubtitle(),"\n\n\n");
setTextString(getTitle()," \n");
setDisplay(getTitle(),true);
ENDSTYLE
ON GRAPH SET STYLE *
TYPE=HEADING, LINE=1, ITEM=1, OBJECT=TEXT, SIZE=10, STYLE=BOLD, FONT='ARIAL', JUSTIFY=CENTER, $
ENDSTYLE
END

RESULT:
--------
I have given three colors for my graph:Yellow, Blue, Green

But the result is not showing Green color alone. Is there any way to get all the three mentioned colors???

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


WebFocus Version 7.7.05
Windows, HTML/PDF/EXL2K/AHTML
February 03, 2012, 10:35 AM
SriAravind
Every time i get violet color in my graph, irrespective of no.of slices in pie graph.....

If there is only one slice in pie graph, then its in same violet color. Tht color is appearing in all circumstances....

Is this the default color? Hw can we avoid in that case?


WebFocus Version 7.7.05
Windows, HTML/PDF/EXL2K/AHTML
February 03, 2012, 01:52 PM
Dan Satchell
Remove this line - it sets the color for the first slice to purple.

setFillColor(getSeries(0),new Color(118,101,188));

Also, change the series numbers from 1,2,3 to 0,1,2 in the other setFillColor statements.


WebFOCUS 7.7.05
February 06, 2012, 12:48 AM
SriAravind
Thank you Dan Satchell ....Its working now.

In addition to this, whether specific coloring for specific slice is possible?

Like for 'BMW' - Blue color, 'MASERATI' - Yellow, 'JAGUAR' - Green

How this can be achieved?


WebFocus Version 7.7.05
Windows, HTML/PDF/EXL2K/AHTML
February 06, 2012, 05:43 AM
SriAravind
Yeah...I got the solution for this...I included the below code in style part:

ON GRAPH SET STYLE *
TYPE=DATA,COLOR=BLUE,WHEN=N1 EQ 'BMW', $
TYPE=DATA,COLOR=YELLOW,WHEN=N1 EQ 'MASERATI', $
TYPE=DATA,COLOR=GREEN,WHEN=N1 EQ 'JAGUAR', $
ENDSTYLE

Its working fine....Any other way or suggestions are always welcome.....


WebFocus Version 7.7.05
Windows, HTML/PDF/EXL2K/AHTML