Focal Point
[CLOSED] Show data values in % in percentage stacked bar graph

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

December 14, 2004, 10:24 PM
<kj>
[CLOSED] Show data values in % in percentage stacked bar graph
Is there a way to show data values in % of total in the bar, in a percentage stacked bar graph (graph type : VBRSTKPC).
I want to show the exact % value of each element in a stacket bar with respect to total value of all elements in that bar. I could show % in incremental.
Means when it displays the second stack % value it is adding first one and second one. Is there a show individual % values?
I would appreciate if some one could respond ASAP.
Thanks in advance,
kj

This message has been edited. Last edited by: Kerry,
December 16, 2004, 07:58 PM
<kj>
Is there any one know how to get this?

Thanks,
kj
August 31, 2010, 01:03 PM
Commando Dave
I have the same problem, kj. I see nobody has posted the solution to this since 2003. Anyhoo I'll give this thread a bump to the community one time before I open a case.

The following code provides a talking point. Notice that the percentages displayed in the graph are the cumulative numbers rather than the percentage of that slice. Its curious that if you run the code as a table request the distinct percentages that I want to show in the graph are shown, rather than the cumulative.

Also of note: The sort must be in the opposite order in the table than in the graph.

Also Also of note: The percentages don't come out the same in the graph and the table (see England/2 seats at 30% in the report and 31% in the graph)

Also also also of note: The legend has to be flipped around (setLegendReverse(true)Wink or it comes out in the reverse order of the stacked values in the graph. The default behavior is annoying but I did find the fix. The advanced graph doesn't apparently offer an option to flip the legend but the basic painter does.

anyway...take a gander at this badboy:

TABLE FILE CAR
SUM COMPUTE PCT_TRX/F7%=PCT.SEATS; AS ''
ACROSS COUNTRY AS ''
BY HIGHEST SEATS AS ''
ON TABLE SET PAGE NOPAGE
END

GRAPH FILE CAR
-* Created by Advanced Graph Assistant
SUM COMPUTE PCT_TRX/F7%=PCT.SEATS ;
BY CAR.BODY.SEATS
ACROSS CAR.ORIGIN.COUNTRY
ON GRAPH PCHOLD FORMAT PNG
ON GRAPH SET HTMLENCODE ON
ON GRAPH SET GRAPHDEFAULT OFF
ON GRAPH SET VZERO ON
ON GRAPH SET HAXIS 770
ON GRAPH SET VAXIS 405
ON GRAPH SET UNITS PIXELS
ON GRAPH SET LOOKGRAPH VBRSTKPC
ON GRAPH SET BARNUMB ON
ON GRAPH SET 3D OFF
ON GRAPH SET GRID ON
ON GRAPH SET GRMERGE ADVANCED
ON GRAPH SET GRMULTIGRAPH 0
ON GRAPH SET GRLEGEND 1
ON GRAPH SET GRXAXIS 1
ON GRAPH SET GRAPHSTYLE *
setTemplateFile("/images/tdg/template/IBISouthWestern.txt");
setReportParsingErrors(false);
setSelectionEnableMove(false);
setDepthRadius(5);
setTransparentBorderColor(getChartBackground(),true);
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);
setLegendMarkerPosition(4);
setMarkerDisplay(false);
setConnectLineMarkers(false);
setConnectScatterMarkers(false);
setO1LabelDisplay(true);
setO1AxisSide(0);
setO1MajorGridDisplay(true);
setO1MajorGridStyle(0);
setO1MinorGridDisplay(false);
setAxisAssignment(0,0);
setSeriesType(0,1);
setY1LabelDisplay(true);
setY1AxisSide(0);
setY1MajorGridDisplay(true);
setY1MajorGridStyle(0);
setY1MinorGridDisplay(false);
setTextFormatPreset(getY1Label(),-1);
setTextFormatPattern(getY1Label(),"#.##");
setPieFeelerTextDisplay(1);
setPieLabelDisplay(0);
setTextFormatPreset(getPieSliceLabel(),1);
setLegendDisplay(true);
setLegendReverse(true);
setFontSizeAbsolute(getY1Title(),true);
setFontSizeAbsolute(getY1Label(),true);
setFontSizeAbsolute(getY2Title(),true);
setFontSizeAbsolute(getY2Label(),true);
setFontSizeAbsolute(getO1Title(),true);
setPlace(true);
setLegendPosition(2);
ENDSTYLE
END

Thanks,
Commando Dave