Focal Point
[solved]Rounding off decimal precision to 3 digits with % in PIE graph

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

March 20, 2012, 05:55 AM
SriAravind
[solved]Rounding off decimal precision to 3 digits with % in PIE graph
I have a PIE graph in which data is dispalyed with 2 digit decimal precision in %(Example - 4.59%).

Now i want to round the decimal precision to 3 digits (Example - 4.592%). How do i achieve that?

Sample code where its displayed with two decimal places:
  
GRAPH FILE CAR
SUM
DEALER_COST
BY CAR
WHERE CAR EQ 'BMW' OR 'MASERATI' OR 'JAGUAR' OR 'TOYOTA' OR 'AUDI' OR 'TRIUMPH'

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);
setTransparentBorderColor(getSeries(4),true);
setTransparentBorderColor(getSeries(5),true);
setTransparentBorderColor(getSeries(6),true);
setTransparentBorderColor(getSeries(7),true);
setTransparentBorderColor(getSeries(8),true);
setTransparentBorderColor(getSeries(9),true);
setTransparentBorderColor(getSeries(10),true);
setPieDepth(10);
setPlace(true);
setPieLabelDisplay(3);

setPieFeelerTextFormat(4);

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(5),new Color(164,120,90));
setFillColor(getSeries(6),new Color(191,68,62));
setFillColor(getSeries(7),new Color(153,102,51));
setFillColor(getSeries(8),new Color(145,165,65));
setFillColor(getSeries(9),new Color(95,160,160));
setFillColor(getSeries(10),new Color(176,96,140));
setFontSizeAbsolute(getPieSliceLabel(),true);
setFontSizeInPoints(getPieSliceLabel(),8);
setPlaceResize(getPieSliceLabel(),0);
setFontSizeAbsolute(getPieLabel(),true);
setFontSizeInPoints(getPieLabel(),8);
setPlaceResize(getPieLabel(),0);
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=DATA,COLOR=RGB(211 203 79),WHEN=N1 EQ 'BMW', $
TYPE=DATA,COLOR=RGB(164 120 190),WHEN=N1 EQ 'MASERATI', $
TYPE=DATA,COLOR=RGB(78 143 109),WHEN=N1 EQ 'JAGUAR', $
TYPE=DATA,COLOR=RGB(66 102 179),WHEN=N1 EQ 'TOYOTA', $
TYPE=DATA,COLOR=RGB(214 130 40),WHEN=N1 EQ 'AUDI', $
TYPE=DATA,COLOR=RGB(153 102 51),WHEN=N1 EQ 'TRIUMPH', $
ENDSTYLE
END


Result:


Have anyone come across like this? Thanks in advance...

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


WebFocus Version 7.7.05
Windows, HTML/PDF/EXL2K/AHTML
March 20, 2012, 08:57 AM
GamP
The setting of the graph engine allows 0, 1 or 2 decimal numbers to be shown with the percent value.
There just are no more options than those.
If you need 3 decimals to be shown, the only alternative as I see it is to try and calculate it yourself and then include your own calculations in the graph.


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
March 20, 2012, 04:48 PM
Waz
You can override the format, and specify your own.

Use setPieFeelerTextFormatPattern.

GRAPH FILE CAR
SUM
DEALER_COST
BY CAR
WHERE CAR EQ 'BMW' OR 'MASERATI' OR 'JAGUAR' OR 'TOYOTA' OR 'AUDI' OR 'TRIUMPH'

-*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);
setTransparentBorderColor(getSeries(4),true);
setTransparentBorderColor(getSeries(5),true);
setTransparentBorderColor(getSeries(6),true);
setTransparentBorderColor(getSeries(7),true);
setTransparentBorderColor(getSeries(8),true);
setTransparentBorderColor(getSeries(9),true);
setTransparentBorderColor(getSeries(10),true);
setPieDepth(10);
setPlace(true);
setPieLabelDisplay(3);

-*setPieFeelerTextFormat(4);
setPieFeelerTextFormat(-1);
setPieFeelerTextFormatPattern("#0.000%");

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(5),new Color(164,120,90));
setFillColor(getSeries(6),new Color(191,68,62));
setFillColor(getSeries(7),new Color(153,102,51));
setFillColor(getSeries(8),new Color(145,165,65));
setFillColor(getSeries(9),new Color(95,160,160));
setFillColor(getSeries(10),new Color(176,96,140));
setFontSizeAbsolute(getPieSliceLabel(),true);
setFontSizeInPoints(getPieSliceLabel(),8);
setPlaceResize(getPieSliceLabel(),0);
setFontSizeAbsolute(getPieLabel(),true);
setFontSizeInPoints(getPieLabel(),8);
setPlaceResize(getPieLabel(),0);
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=DATA,COLOR=RGB(211 203 79),WHEN=N1 EQ 'BMW', $
TYPE=DATA,COLOR=RGB(164 120 190),WHEN=N1 EQ 'MASERATI', $
TYPE=DATA,COLOR=RGB(78 143 109),WHEN=N1 EQ 'JAGUAR', $
TYPE=DATA,COLOR=RGB(66 102 179),WHEN=N1 EQ 'TOYOTA', $
TYPE=DATA,COLOR=RGB(214 130 40),WHEN=N1 EQ 'AUDI', $
TYPE=DATA,COLOR=RGB(153 102 51),WHEN=N1 EQ 'TRIUMPH', $
ENDSTYLE
END



Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

March 21, 2012, 02:15 AM
SriAravind
Thank you Waz...
Is it possible to display data as "<1%" in the graph if the value is less than 1%[whatever it might be i.e. 0.005, 0.999)? How to achieve that?

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


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