I have a graph with data points over 4 years and I want to add another line that represents the average across all the years (it will display as a straight line through my data). I have created a HOLD file that captures this information from my data using a COMPUTE and then I'm trying to READ the variable in so I can call it into my graph but I either get a FOC339 error OR I get data that is absolutely incorrect. What am I missing.
This message has been edited. Last edited by: Meghan,
Prod: WebFOCUS 7.6.6 on Win XP
Posts: 28 | Location: Bellingham, WA | Registered: July 28, 2008
You can calculate the average and then plot both the average and the yearly values on the same graph. See a constructed example using the CAR file:
SET ASNAMES=ON
TABLE FILE CAR
SUM SALES BY MPG
ON TABLE HOLD AS H1
END
TABLE FILE H1
SUM AVE.SALES AS AVESALES
SUM SALES BY MPG
ON TABLE HOLD AS H2
END
GRAPH FILE H2
SUM AVESALES SALES
ACROSS MPG
ON GRAPH SET LOOKGRAPH VLINE
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(true);
setConnectScatterMarkers(true);
setO1LabelDisplay(true);
setO1AxisSide(0);
setO1MajorGridDisplay(true);
setO1MajorGridStyle(0);
setO1MinorGridDisplay(false);
setAxisAssignment(0,0);
setSeriesType(0,2);
setAxisAssignment(1,0);
setSeriesType(1,2);
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 *
SQUEEZE=ON,
ORIENTATION=PORTRAIT,
$
TYPE=REPORT,
GRID=OFF,
FONT='TIMES NEW ROMAN',
SIZE=10,
$
ENDSTYLE
END
Thank you all for your responses. Unfortunately none of the above solutions worked. Instead I put the line as a variable in my SQL statement BEFORE bringing it in to IBI and then just plotted it as another data line.
Not the most elegant but oh well.
Prod: WebFOCUS 7.6.6 on Win XP
Posts: 28 | Location: Bellingham, WA | Registered: July 28, 2008
Meghan, I've manipulated Daniel's fex to add a reference line to it, have a look.
TABLE FILE TRADES
SUM AMOUNT
BY DATE_OF_TRADE
ON TABLE HOLD AS HLD_AMT
END
-RUN
TABLE FILE HLD_AMT
SUM AVE.AMOUNT
ON TABLE SAVE AS AVE_AMT
END
-RUN
-READ AVE_AMT &AGE_AMT.A16.
GRAPH FILE TRADES
SUM AMOUNT
ACROSS DATE_OF_TRADE
ON GRAPH SET LOOKGRAPH VLINE
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 GRAPHSTYLE *
setMarkerDisplay(true);
setConnectLineMarkers(true);
setConnectScatterMarkers(true);
setO1LabelDisplay(true);
setO1AxisSide(0);
setO1MajorGridDisplay(true);
setO1MajorGridStyle(0);
setO1MinorGridDisplay(false);
setAxisAssignment(0,0);
setSeriesType(0,2);
setAxisAssignment(1,0);
setSeriesType(1,2);
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);
setReferenceLine(getY1Axis(),0, &AGE_AMT);
setLineWidth(getReferenceLine(getY1Axis(),0),3);
setFillColor(getReferenceLine(getY1Axis(),0), new Color(255,0,0));
setPlace(true);
ENDSTYLE
END
Waz...
Prod:
WebFOCUS 7.1.6
Upgrade:
WebFOCUS 7.6.6
OS:
Unix
Outputs:
PDF, CSV, Excel, TXT, XML, HTML
Posts: 381 | Location: Sydney, Australia | Registered: October 31, 2006