Focal Point
Chart Lengend sorting problem

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

December 20, 2007, 01:38 PM
DKWAN
Chart Lengend sorting problem
We have a stacked chart and the normal display sequence works until our users would like to sort by the 'specification' rather by the field's content.
For example, current the top one on the stacked bar chart is Returning then following by New, and by Continue HS and Continue. However, it is expected to put the stacking order as
Concurrent HS follow by Retruning, Continue and bottom item on the stacked bar is New.

I try to use a decode and put part in correct order, but the LENGEND showing up with the decoded value rather than the fieldvalue such as New or continue, etc.

Any idea how I can put the FIELDVALUE rather than the decoded vlaue on the lengend area.
Please advice.Thanks.




Prod: WebFOCUS 7.1.1 CGI - Self Service - Report Caster,Win2000/IIS
Output: HTML, Excel 2000 and PDF
December 20, 2007, 02:27 PM
GinnyJakes
DKWAN,

Here is an example. I'm not including all of the code but I'll try to annotate it. This is part of a program I wrote for one of our eBusiness guys that wanted a graph of the top 12 resources being hit. Well as in your case, the input file to the graph was sorted by a hit id and we wanted to display resource name.

TABLE FILE EBHITS1
SUM HIT_ID
    SESSION_ID
BY  RESOURCE_NAME
ON TABLE HOLD AS EBHITS2
END
TABLE FILE EBHITS2
SUM HIT_ID
    SESSION_ID
BY HIGHEST 12 HIT_ID NOPRINT
BY  RESOURCE_NAME
ON TABLE HOLD AS EBHITS12
END
-* Now we have the file that we are going to input into the graph.
-* But we have to get the resource name in the same order as the hit id.
TABLE FILE EBHITS12
PRINT RESOURCE_NAME
ON TABLE SAVE
END
-* Now we have the resource names in a file in the right order.  We want to connect them to a variable
-* name with an index that we will use later.  That is what this Dialogue Manager code does.
-RESOURCE
-RUN
-SET &I=0;
-REPEAT GRAPH 12 TIMES
-READ SAVE NOCLOSE &RES_NAME.A20.
-IF &RETCODE NE 0 GOTO GRAPH;
-SET &I=&I+1;
-SET &RES_NAME.&I=&RES_NAME;
-GRAPH
-*  Now we get to to the graph.
GRAPH FILE EBHITS12
HEADING
"<55 XXXX.com Static Web Site"
FOOTING
"<65 30 Days Running"
PRINT HIT_ID AS 'Page Views' SESSION_ID AS 'Sessions'
-*PRINT HIT_ID1000 AS 'Page Views' SESSION_ID1000 AS 'Sessions'
BY RNK.HIT_ID AS ''
ON GRAPH SET LOOKGRAPH BAR
ON GRAPH SET GRAPHEDIT OFF
ON GRAPH SET HAXIS 500
ON GRAPH SET VAXIS 300
ON GRAPH SET BARNUMB OFF
ON GRAPH SET 3D OFF
ON GRAPH SET VZERO ON
ON GRAPH SET GRID OFF
ON GRAPH SET GRAPHSTYLE *
setX1LabelDisplay(true);
setX1AxisSide(0);
setX1MajorGridDisplay(true);
setX1MajorGridStyle(0);
setX1MinorGridDisplay(false);
setFontSizeAbsolute(getX1Title(),true);
setFontSizeAbsolute(getX1Label(),true);
setMarkerDisplay(false);
setConnectLineMarkers(false);
setConnectScatterMarkers(false);
-*  This is where we start the loop to populate the setGroupLabel method once for each series on the graph.
-*  Since series numbers are relative to zero, we have to have two counters.
-*  &J will count the series.  In this case, it will go from 0 to 11.
-*  &I will match the index variable name set above.  It will go from 1 to 12.
-SET &I=1;
-SET &J=0;
-REPEAT ENDGROUP 12 TIMES
setGroupLabel(&J,"&RES_NAME.&I");
-SET &I=&I+1;
-SET &J=&J+1;
-ENDGROUP
setO1AxisSide(0);
setO1MajorGridDisplay(false);
setO1MinorGridDisplay(false);  
........................... rest of code


If you don't have a fixed number of series like I do, then you can use the &LINES value from when you create your graph input file. Save it in another variable first so that it doesn't get clobbered by another TABLE request.

Hope you can figure this out. It works great!


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
December 21, 2007, 07:10 PM
DKWAN
Hi
Thanks for your help.
I found the following works for what I need.
Thanks agian.
d

..

setSeriesLabel(3, "Concurrent ");
setSeriesLabel(2, "Returning");
setSeriesLabel(1, "Continuing");
setSeriesLabel(0, "New Total");




Prod: WebFOCUS 7.1.1 CGI - Self Service - Report Caster,Win2000/IIS
Output: HTML, Excel 2000 and PDF