I am new to creating graphs in WebFOCUS. I am trying to create a bar graph that shows usage by month. When I do the following : SUM ITEM_COUNT AS '# of Items' BY MONTH AS 'Month'
The months are listed as 'April,February,..' I want it to list as 'January, February,..'
Can somebody show me how to do that ?
Thanks, BabuThis message has been edited. Last edited by: Kerry,
May 18, 2005, 07:49 PM
Leah
Try converting the month to a number then do something like as follows: I used CENTORD as month was numeric. Creating the Mtr as the display makes it show the alpa (looked it up under date formats to be correct) SET LOOKGRAPH=BAR SET GRAPHEDIT=SERVER SET GRID=ON SET BARNUM=OFF SET 3D=OFF SET VZERO=ON DEFINE FILE CENTORD MONTHA/Mtr = MONTH; END GRAPH FILE CENTORD SUM QUANTITY -*ACROSS MONTH ACROSS MONTHA WHERE YEAR EQ '2001' ON GRAPH SET GRAPHSTYLE * setLegendDisplay(true); setLegendMarkerPosition(0); setMarkerDisplay(true); setConnectLineMarkers(false); setConnectScatterMarkers(false); setO1LabelDisplay(true); setO1AxisSide(0); setO1MajorGridDisplay(true); setO1MajorGridStyle(0); setO1MinorGridDisplay(false); setSeriesType(0,1); setY1LabelDisplay(true); setY1AxisSide(0); setTextFormatPreset(getY1Label(),1); setY1MajorGridDisplay(true); setY1MajorGridStyle(0); setY1MinorGridDisplay(false); setPieFeelerTextDisplay(1); setTextFormatPreset(getPieSliceLabel(),1); setPieLabelDisplay(0); ENDSTYLE ON GRAPH SET STYLE * ENDSTYLE END
May 20, 2005, 11:18 AM
<JG>
An alternative to defining a dummy is to use the ACROSS COLUMNS method
SUM ITEM_COUNT AS '# of Items' ACROSS MONTH AS 'Month' COLUMNS 'january' and 'february' and 'march' .....etc.
The quoted column names are case senitive. It has the advantage that if working with fixed sorts such a state etc you. can arrange them in any order you like.
May 23, 2005, 03:55 AM
susannah
bch, Is your MONTH an Alpha field? If so focus assumes the order to be simply alphabetical.. April, December, February, July, June,May,... You need to convert it to a DATE field, so that FOCUS will know the order. So whatever numeric field you generated your MONTH name from, can you go back to it and make it a smartdate? If not, then JG's way is easiest i think.
May 23, 2005, 08:19 PM
bchinnap
Thanks JG, Yours is the closest I can get it to work.
I have a similar question with an other graph I am working with. Here I am doing a Top 10 items usage bar graph as : SUM item_count BY item
Here again, the items in x axis are listed alphabetically and I want them printed by item_count value descending.
Thanks for any help you guys can provide.
May 23, 2005, 08:31 PM
susannah
same issue. same answer. you need to tell focus the order you want, if the labels aren't in the order you need. in your case you'll have to determine the order dynamically, based on the values, build a file of the column names in the order you'll need, then read that file following the COLUMNS command. SEE JG'S POST ON PAGE 2 OF THIS THREAD
May 23, 2005, 09:43 PM
j.gross
You may be able to use
graph file ... sum item_count by total item_count noprint by item ...
May 25, 2005, 01:10 AM
susannah
would that it were true, but the NOPRINT doesn't work in GRAPH (3rd party software). JG taught me that, and the work around, COLUMNS. Boy that would simplify our lives, if it worked.
May 27, 2005, 12:37 PM
j.gross
I said "may". I've been through that before, but I don't think it's a documented disability, so it could be miraculously cured in any release.
I'd lay the blame on the 2nd party, not the 3rd. Focus takes your GRAPH FILE syntax, and hands the graph package an ordered set of (x,y) points and labels plus formatting instructions. The desired output (using the BY ... NOPRINT to order the data, and the additional BY to supply the labels) is unambiguously clear, and s/b no great challenge to handle that way and generate the graph-package directives. -- It's the Focus reporting engine that needs improvement here, not the graph package.
May 27, 2005, 01:33 PM
<JG>
Page 673 Creating Reports With WebFOCUS Language Version 5 Release 2
quote:
To temporarily hide the display of a Y-axis field, add the NOPRINT command to the field. Although the NOPRINT command applies to both verb objects and sort fields in a TABLE request, it only applies to verb objects in a GRAPH request.
Actually as of 7.1 both COMPUTE and NOPRINT are supported for Graph
May 27, 2005, 02:12 PM
mgrackin
The key here in this thread of discusssion is the need for NOPRINT to work with a BY (or ACROSS) phrase in GRAPH FILE. I asked Larry Eiss about this via email before Summit (sorry Larry) and he indicated that using NOPRINT with a BY phrase seemed to work for him. He wasn't sure which version of WF it got into but definitely not before 5.3. I am still using 5.2.3 and 5.2.5 so I can't check for it in 5.3. Does anyone have this version (or later) so they can verify if support for NOPRINT with a BY phrase works after 5.3?
May 27, 2005, 02:34 PM
<JG>
Just checked it in 5.3.3 and it works in that version even though the 5.3 documentation page 815 says it does not
July 01, 2011, 11:23 AM
webFocus_reporter
this might help...
SET ASNAMES = ON TABLE FILE CAR SUM CNT.CAR.COMP.CAR AS 'XCAR' BY CAR.ORIGIN.COUNTRY AS 'XCOUN'
ON TABLE SET PAGE-NUM NOLEAD ON TABLE NOTOTAL ON TABLE HOLD AS CARTEST ON TABLE SET HTMLCSS ON ON TABLE SET STYLE * INCLUDE = endeflt, $ TYPE=REPORT, LINES-PER-PAGE=20, REPORT-VIEW=CHART, CHART-TYPE=BAR, $ ENDSTYLE END
TABLE FILE CARTEST PRINT CARTEST.CARTEST.XCOUN CARTEST.CARTEST.XCAR BY HIGHEST 2 CARTEST.CARTEST.XCAR NOPRINT ON TABLE SET PAGE-NUM NOLEAD ON TABLE NOTOTAL ON TABLE HOLD AS CARTEST1 ON TABLE SET HTMLCSS ON ON TABLE SET STYLE * INCLUDE = endeflt, $ TYPE=REPORT, LINES-PER-PAGE=20, $ TYPE=REPORT, COLUMN=N3, SEQUENCE=2, $ TYPE=REPORT, COLUMN=N2, SEQUENCE=1, $ ENDSTYLE END
GRAPH FILE CARTEST1 SUM CARTEST1.CARTEST1.XCAR ACROSS CARTEST1.CARTEST1.XCOUN 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 * setMarkerDisplay(true); setConnectLineMarkers(false); setConnectScatterMarkers(false); setO1LabelDisplay(true); setO1AxisSide(0); setO1MajorGridDisplay(true); setO1MajorGridStyle(0); setO1MinorGridDisplay(false); setAxisAssignment(0,0); setY1LabelDisplay(true); setY1AxisSide(0); setY1MajorGridDisplay(true); setY1MajorGridStyle(0); setY1MinorGridDisplay(false); setTextFormatPreset(getY1Label(),-1); setTextFormatPattern(getY1Label(),"#.##"); setPieFeelerTextDisplay(1); setPieLabelDisplay(0); setTextFormatPreset(getPieSliceLabel(),1); setRiserBorderMode(1); setSeriesDefaultTransparentBorderColor(true); setUseSeriesBorderDefaults(true); setLegendDisplay(true); setFontSizeAbsolute(getY1Title(),true); setFontSizeAbsolute(getY1Label(),true); setFontSizeAbsolute(getY2Title(),true); setFontSizeAbsolute(getY2Label(),true); setFontSizeAbsolute(getO1Title(),true); setPlace(true); ENDSTYLE ON GRAPH SET STYLE * $ ENDSTYLE END