Focal Point
[CLOSED] Sort in Bar Graphs

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

July 06, 2009, 03:17 PM
SG
[CLOSED] Sort in Bar Graphs
Hi All,

I am having problems in sorting Across.

GRAPH FILE CAR
SUM SALES
ACROSS COUNTRY
ON GRAPH SET LOOKGRAPH VBAR
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 PCHOLD FORMAT PNG
ON GRAPH SET GRAPHSTYLE *
ENDSTYLE
ON GRAPH SET STYLE *
SQUEEZE=ON,
ORIENTATION=PORTRAIT,
$
TYPE=REPORT,
GRID=OFF,
FONT='TIMES NEW ROMAN',
SIZE=10,
$
ENDSTYLE
END

I want to sort the graph based on sales values instead of country name.


Thanks,
SG.

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


Webfocus 7.6.8
PDF,HTML & EXCEL
July 07, 2009, 03:46 AM
GamP
If you want to sort across sales, then do so.
Only thing (in this example at least) is that a certain sales value is present more than once, so the graph is not exactly what you want if you just do an across sales.
Solution in this case is to do the sum and hold it, and then do the graph on the hold file.
TABLE FILE CAR
SUM SALES 
BY SALES
ON TABLE HOLD
END

GRAPH FILE HOLD
SUM SALES 
ACROSS SALES
....  

Hope this helps ...


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
July 07, 2009, 08:32 AM
Danny-SRL
SG,

If I understand you correctly, you want to sum sales by country but display sorted by ascending values of the summed sales.
Here is a possible solution:
  
-* File SG2.fex
SET HOLDLIST=PRINTONLY
TABLE FILE CAR
SUM CAR.BODY.SALES
RANKED BY TOTAL SALES
BY CAR.ORIGIN.COUNTRY
ON TABLE HOLD
END
DEFINE FILE HOLD
RK/I5=RANK - 1;
GRLABEL/A70 = 'setGroupLabel(' | EDIT(RK) | ', "' | COUNTRY | '");'
END
FILEDEF LABS DISK LABS.FEX
TABLE FILE HOLD
PRINT GRLABEL
BY RK NOPRINT
ON TABLE SAVE AS LABS
END
-RUN
GRAPH FILE HOLD
SUM SALES
BY RK AS Country
ON GRAPH PCHOLD AS HOLD FORMAT PNG
ON GRAPH SET GRAPHDEFAULT OFF
ON GRAPH SET GRMERGE ADVANCED
ON GRAPH SET GRMULTIGRAPH 0
ON GRAPH SET GRLEGEND 0
ON GRAPH SET GRXAXIS 1
ON GRAPH SET HAXIS 770
ON GRAPH SET VAXIS 405
ON GRAPH SET UNITS PIXELS
ON GRAPH SET LOOKGRAPH VBAR
ON GRAPH SET GRAPHSTYLE *
setReportParsingErrors(false);
setSelectionEnableMove(false);
setSeriesAreRows(true);
setDisplay(getO1Title(),true);
-INCLUDE LABS
ENDSTYLE
ON GRAPH SET STYLE *
ENDSTYLE
END

This message has been edited. Last edited by: Danny-SRL,


Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF