Focal Point
ROWS..OVER.. With Graphs

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

October 04, 2007, 05:02 PM
gweller
ROWS..OVER.. With Graphs
Is it possible to use the ROWS OVER Method within a graph form.

I have tried, but it turns my legend into numerical values instead of keeping the proper values for the column:

Example with some formatting code stripped out:
  GRAPH FILE CAR
SUM CNT.COUNTRY AS ''
BY CAR ROWS 'BMW' OVER 'DATSUN' OVER 'JAGUAR'
ACROSS COUNTRY
ON GRAPH SET LOOKGRAPH VBRSTK1
ON GRAPH SET GRAPHEDIT SERVER
ON GRAPH SET BARNUMB OFF
ON GRAPH SET 3D OFF
ON GRAPH SET VZERO ON
ON GRAPH SET GRID ON
ON GRAPH SET VAXIS 4.500
ON GRAPH SET HAXIS 10.000
ON GRAPH SET UNITS INCHES
ON GRAPH SET GRMERGE ON
ON GRAPH PCHOLD FORMAT SVG
ON GRAPH SET GRAPHSTYLE *
END



WebFOCUS 8201M/Windows Platform
October 04, 2007, 05:26 PM
GinnyJakes
ROWS OVER is a TABLE command, not graph. There are other ways of dealing with legends on a graph. Maybe you can describe in more detail what you are expecting out of this graph. When I run your code without the ROWS OVER, I get alphanumeric legend values.

Maybe you could explain in more detail what you are looking for.


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
October 04, 2007, 05:32 PM
gweller
I have a graph with an x and a y that both need to display income brackets. Problem is that they both want to display in an alpha numeric fashion instead of numeric. So for example my brackets are:

'$0-4999'
'$5000 - 9999'
'$10000 - 14999'

Which in the graph would be displayed
'$0-4999'
'$10000 - 14999'
'$5000 - 9999'

Now using the ACROSS COLUMNS statement I can alter my across values...Just not sure how to handle the BY


WebFOCUS 8201M/Windows Platform
October 05, 2007, 03:31 AM
Tony A
Perform a sort by the range value first (numeric) with a NOPRINT and then by the textual value -
DEFINE FILE GGSALES
  BASE_RANGE/P6 = IF UNITS FROM    0 TO  199 THEN  199
             ELSE IF UNITS FROM  200 TO  399 THEN  399
             ELSE IF UNITS FROM  400 TO  599 THEN  599
             ELSE IF UNITS FROM  600 TO  799 THEN  799
             ELSE IF UNITS FROM  800 TO  999 THEN  999
             ELSE IF UNITS FROM 1000 TO 1199 THEN 1199
             ELSE IF UNITS FROM 1200 TO 1399 THEN 1399
             ELSE IF UNITS GE   1400         THEN 1599;
  RANGE_TXT/A50 = DECODE BASE_RANGE(199   '0 to 199'  399   '200 to 399'  599   '400 to 599'  799   '600 to 799'
                                    999 '800 to 999' 1199 '1000 to 1199' 1399 '1200 to 1399' 1599 '1400 to ~'
                                    ELSE '????');
END

GRAPH FILE GGSALES
SUM CNT.REGION
BY BASE_RANGE NOPRINT
BY RANGE_TXT
ON GRAPH SET GRMERGE ON
END
-RUN

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
October 05, 2007, 04:11 AM
GamP
Using ROWS ... OVER in GRAPH, you indeed get strange results in your legend.
This can by remedied by first storing the result os the ROWS ... OVER request in a hold f ile and use this hold file as input for the GRAPH.
See following:
[CODE]
TABLE FILE CAR
SUM SALES
BY CAR ROWS 'BMW' OVER 'DATSUN' OVER 'JAGUAR'
BY COUNTRY
ON TABLE HOLD FORMAT ALPHA
END

GRAPH FILE HOLD
SUM SALES
ACROSS COUNTRY
BY E01 AS CAR
HEADING
"Sales per car per country"
ON GRAPH SET LOOKGRAPH 3D_BAR
ON GRAPH SET GRAPHEDIT SERVER
ON GRAPH SET BARNUMB OFF
ON GRAPH SET 3D ON
ON GRAPH SET VZERO ON
ON GRAPH SET GRID ON
ON GRAPH SET GRMERGE ON
ON GRAPH PCHOLD FORMAT PNG
END
[/CODE}
In the GRAPH you reference E01 in stead of CAR because the BY ROWS causes the car field to be stored in the master file as a field without a name.
If this is also useable for your problem .... Hope so.


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
October 05, 2007, 11:11 AM
gweller
I tested this out, and the problem is that the ROWS Command may sort within the original table but the subsequent GRAPH command seems to again resort by alpha values...

EX:
 
TABLE FILE CAR
SUM SALES
BY CAR ROWS 'JAGUAR' OVER 'BMW' OVER 'DATSUN'
BY COUNTRY
ON TABLE HOLD FORMAT ALPHA
END
 


The desired output would be Jaguar, BMW, Datsun the actual output in graph form is BMW, Datsun, Jaguar...


WebFOCUS 8201M/Windows Platform
October 05, 2007, 11:19 AM
gweller
Tony,

Your method works until you add an Across clause, once you add an across, it seems as though the original noprint is ignored...


WebFOCUS 8201M/Windows Platform
October 08, 2007, 09:46 AM
PBrightwell
Try making your values:
$ 0-4999
$ 5000-9999
and $10000-14999


Pat
WF 7.6.8, AIX, AS400, NT
AS400 FOCUS, AIX FOCUS,
Oracle, DB2, JDE, Lotus Notes
October 22, 2007, 04:42 PM
gweller
Kind of a hack but it works like a charm...

I have implemented it like this until/if I find a better solution.

Thanks


WebFOCUS 8201M/Windows Platform