Focal Point
[CLOSED] Graphs in Excel

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

May 02, 2008, 11:18 AM
TryFocus
[CLOSED] Graphs in Excel
Hi Everyone,

I'm having a tough time creating Graph & loading into EXL2K.

Can anybody give me a sample code for creating Graph & pulling graph into Excel.

Thanks

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


Prod: WF 7.6.10 windows. -- MRE/Dashboard/Self Service/ReportCaster - Windows XP
May 02, 2008, 11:55 AM
Tom Flynn
  
-SET &ECHO=ALL;
-SET &R          = RDUNIF('D4.2') * 10000;
-SET &APPFOLDER  = 'baseapp/';
-SET &USERID     = GETUSER('A8');
-SET &LC_USER    = LOCASE(8, &USERID, 'A8');
-SET &GIF_FILE   = &LC_USER || &R || '.jpg' ;
-SET &PATH       = &APPFOLDER || &GIF_FILE;
APP FI GRAPH2 DISK &PATH
-RUN

GRAPH FILE CAR
HEADING CENTER
"TOTAL RETAIL COST BY COUNTRY"
" "
SUM RETAIL_COST AS ''
ACROSS COUNTRY
ON GRAPH SET GRAPHDEFAULT OFF
ON GRAPH SET HAXIS 770
ON GRAPH SET VAXIS 405
ON GRAPH SET UNITS PIXELS
ON GRAPH SET LOOKGRAPH PIE
ON GRAPH SET GRMERGE ON
ON GRAPH SET GRMULTIGRAPH 0
ON GRAPH SET GRLEGEND 0
ON GRAPH SET GRXAXIS 2
ON GRAPH HOLD AS GRAPH2 FORMAT JPEG
ON GRAPH SET STYLE *
-*TYPE = DATA,    FOCEXEC=app/CAR_DRILL(COUNTRY = A1), ACROSSCOLUMN=RETAIL_COST, TARGET=_blank, $
TYPE = REPORT,  FONT=VERDANA, SIZE=9, $
TYPE = HEADING, FONT=VERDANA, SIZE=10, STYLE=BOLD, $
ENDSTYLE
ON GRAPH SET GRAPHSTYLE *
setTemplateFile("/images/tdg/template/IBISouthWestern.txt");
setFontName(getDataText(),"Verdana");
setDepthAngle(65);
setPieDepth(45);
restoreAllSlices();
setPieFeelerTextDisplay(2);
setPieTilt(25);
setPieLabelDisplay(1);
setDisplay(getPieLabel(),true);
setLegendAutomatic(false);
setFontStyle(getLegendText(),2);
setFontStyle(getPieSliceLabel(),2);
setTextFormatPreset(getPieSliceLabel(),4);
setFontSizeInPoints(getTitle(),12);
setFontSizeAbsolute(getPieSliceLabel(),true);
setFontSizeInPoints(getPieSliceLabel(),8);
setFontSizeAbsolute(getLegendText(),true);
setFontSizeInPoints(getLegendText(),9);
setTextFormatPattern(getDataText(),"$#,###,###,###.##");
setFontSizeInPoints(getO1Label(),9);
setFontSizeInPoints(getY1Label(),9);
setFontSize(getDataText(),10);
setFontSizeAbsolute(getTitle(),true);
setFontSizeInPoints(getTitle(),12);
setLegendMarkerPosition(0);
setTransparentBorderColor(getChartBackground(),true);
setRect(getPieFrame(), new Rectangle(-15500,-13500,27000,27000));
setRect(getFrame(), new Rectangle(-10400,-10000,25000,30000));
ENDSTYLE
END
-RUN
DEFINE FILE CAR
IMAGE/A200='<img src=http://localhost:8080/approot/baseapp/&GIF_FILE>';
END
TABLE FILE CAR
HEADING
" "
"<IMAGE>"
" "
BY COUNTRY NOPRINT
IF RECORDLIMIT EQ 1
ON COUNTRY SUBFOOT
" "
ON TABLE SET PAGE-NUM OFF
ON TABLE SET HTMLCSS ON
ON TABLE PCHOLD FORMAT EXL2K
ON TABLE SET STYLE *
     UNITS=IN,
     PAGESIZE='Letter',
     LEFTMARGIN=0.400000,
     RIGHTMARGIN=0.050000,
     TOPMARGIN=0.000000,
     BOTTOMMARGIN=0.000000,
     ORIENTATION=LANDSCAPE,
     SQUEEZE=OFF,
     TITLETEXT='Excel Graph',
$
ENDSTYLE
END
-RUN





Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
May 07, 2008, 06:36 PM
Jim Zucker
I can think of a couple of options.

I don't know if you've tried using an Excel template. This would allow you to "tune" your graph with Excel's settings, as Excel is generating the graph.

Another quick option would be to save a graph in WebFOCUS in a graphical format (e.g. GIF), then embed the object in the spreadsheet.


WebFOCUS 53, 71, 76 - All Platforms
August 09, 2010, 04:57 PM
MathematicalRob
In case it helps anyone else, I had to add
SET GRAPHSERVURL=https://my-webfocus-server/ibi_apps/IBIGraphServlet


to the code above.


WebFocus 8201m on Windows; App Studio 8201; Procedures: WebFocus with SQL; HTML Parameter Pages & Dashboard; Output: Excel, HTML, & PDF.
August 10, 2010, 07:31 PM
EWoerle
The way that Tom describes it above is the way it works with the code. If you want to do it a way that I consider a little simpler, then I would create fex to handle your gif (Make sure to do on table save as gifname) and then reference it using the layout composer.

Just an FYI, I've only ever been able to put one image per sheet into excel from webFOCUS. I don't know if tom's way allows anymore.


Eric Woerle
WF 7.6.7 Reportting Server
ETL 7.6.10
Dev Studio 7.6.7
August 11, 2010, 06:48 AM
Cyril Joy
You can use excel template for graphs in excel.


Regards,
Cyril Joy.

WF Production 8008 on Linux.
August 11, 2010, 09:03 AM
Tom Flynn
The above, as well as the link below, was a concept prior to the new layout composer.

Multiple Graphs in 1 worksheet

I don't mess with templates as most clients have converted to Microsoft 2007 suite of products; templates are only supported through 2003...


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe