Focal Point
Pie Graph display problem

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

January 26, 2005, 07:38 PM
wfsharon
Pie Graph display problem
I'm trying to display a 3D pie graph with a legend. This graph will appear in a pdf to the right of a grid laid out something like this

------------+-------
AssetType | % Par
============+=======
HYL | 76.03
------------+-------
HYB | 10.07
------------+-------
REV | 9.42
------------+-------
SWAP CLN | 1.72
------------+-------
IGL | 0.85
------------+-------
CASH | 0.15
------------+-------[/code]I can get the pie with feeler labels showing the percentages, but the colored legend to the right only shows "-- ------" for a label.

How can I get the AssetType column to appear as a legend?

Data Code:
[code]FILEDEF ASSETGR DISK &ASSETGRPATH
SET GRAPHSERVURL=http://IMWFPR01/ibi_apps/IBIGraphServlet
IBIGraphServlet
SET LOOKGRAPH=PIE
SET GRAPHEDIT=SERVER
SET 3D=ON
GRAPH FILE ATHOLD
HEADING CENTER
"Aggregate Investments By Asset Type"
-IF '&Type.EVAL' EQ 'ALL' THEN GOTO PRINT_AT;
"As Of: &DisplayDate"
-PRINT_AT
PRINT
AssetTypeID
GRA_PctPar AS '% Par'

ON GRAPH SET GRAPHSTYLE *
setAutofit(getLegendText(),true);
setAutoshading(true);
setLegendTextAutofit(true);
setLegendDisplay(true);
setLegendAutomatic(true);
setTitleString("Aggregate Investments by Asset Type");
setTextJustHoriz(getTitle(),1);
setPieTilt(45);
setPieDepth(80);
setFontSize(getTitle(),12);
We're on 5.2.4

Thanks in advance!

This message has been edited. Last edited by: <Mabel>,
January 26, 2005, 10:37 PM
N.Selph
Shouldn't "AssetTypeID" be a BY field?
January 27, 2005, 02:39 AM
wfsharon
You're right - should be a BY field!

Code now reads:

FILEDEF ASSETGR DISK &ASSETGRPATHSET
GRAPHSERVURL=http://IMWFPR01/ibi_apps/IBIGraphServletIBIGraphServlet
SET LOOKGRAPH=PIE
SET GRAPHEDIT=SERVER
SET 3D=ON
GRAPH FILE ATHOLD
HEADING CENTER"Aggregate Investments By Asset Type"
-IF '&Type.EVAL' EQ 'ALL' THEN GOTO PRINT_AT;
"As Of: &DisplayDate"
-PRINT_AT
PRINT
GRA_PctPar AS '% Par'
BY AssetTypeID
ON GRAPH SET GRAPHSTYLE *
setAutofit(getLegendText(),true);
setAutoshading(true);
setLegendTextAutofit(true);
setLegendDisplay(true);
setLegendAutomatic(true);
setTitleString("Aggregate Investments by Asset Type");
setTextJustHoriz(getTitle(),1);
setPieTilt(45);
setPieDepth(80);
setFontSize(getTitle(),12);

ENDSTYLE
ON GRAPH HOLD AS ASSETGR FORMAT GIF

END[/code]Same result, though ....

This message has been edited. Last edited by: <Mabel>,
January 27, 2005, 02:59 PM
N.Selph
I've tried your code on another pie chart and gotten labels on the legend. There may be something different about your data?
January 27, 2005, 04:00 PM
wfsharon
Thanks for bearing with me.

I've isolated my graphing code out of the main procedure so that it just displays the graph (without the accompanying grid).

Now I see zeros in the Legend text area! As a matter of fact, now that the chart loads as a java applet (as opposed to being embedded as a GIF), I can run the mouse over each pie slice and get a tooltip showing 0 (DataText) on the top, followed by the '% Par' , followed by the actual data value.

Looking at the underlying source reveals something interesting, though.





The generated java applet settings are in plain site and I notice that the setSeriesLableArray method initializes the AssetType labels that I expect to see as zeros! Hmm... The DataSeries array looks OK.

How do I get the AssetTypeID strings to print here without having to hardcode them?

This message has been edited. Last edited by: <Mabel>,
January 27, 2005, 07:29 PM
wfsharon
Shouldn't the values of the BY clause show as legend text??
January 28, 2005, 02:31 PM
wfsharon
Got it! (kinda silly, too)

Again, Nicola, you hit it right on your second reply about data. I had to do a join to get data together to perform the ratio calculation. The "joined" column name for AssetTypeID ended up as E02.

I just DEFINEd a new column (AssetType) as /A8 and used the AssetTypeID column from the joined table (ATHOLD). The BY clause refers to the new AssetType field and prints out like a charm.

I'm surprised that the AssetTypeID column could not be used naturally from the joined table. At least in the SQL world there is no guess work like this.

Thanks for your help!