Saving a Graph as an Image File

In this section:

You can save graph output to an image file using the GRAPHSERVURL parameter or the JSCOM3 configuration on the WebFOCUS Reporting Server. Saving graph output as an image file is useful when you want to create a single PDF or HTML report that contains multiple outputs, such as output from a TABLE request and a GRAPH request. You can distribute this type of report using ReportCaster.

For details, see Saving a Graph as an Image File Using GRAPHSERVURL.


Top of page

x
Saving a Graph as an Image File Using GRAPHSERVURL

How to:

Reference:

The GRAPHSERVURL parameter enables users who are running against a server environment where the WebFOCUS Reporting Server is installed on a z/OS, Windows, or UNIX machine to save graph output as a GIF file. GIF images can be embedded in a PDF or HTML report.

The GRAPHSERVURL parameter sends an http request to the machine that has the WebFOCUS Graph Servlet. The graph image is created by the WebFOCUS Graph Servlet, and the image is sent back to a temporary location on the WebFOCUS Reporting Server (if an Allocation has not been specified), or to the location specified in a FILEDEF command. You may use the Allocation Wizard to create a FILEDEF command.



x
Procedure: How to Save a Graph as an Image File Using GRAPHSERVURL
  1. Install JDK as per the requirements in the WebFOCUS & ReportCaster Installation & Configuration manual for your platform.
  2. Create a procedure that produces the image, and set GRAPHSERVURL in the procedure to the URL that invokes the WebFOCUS Graph Servlet. For example,
    SET GRAPHSERVURL=http://hostname/ibi_apps/IBIGraphServlet

    where:

    hostname

    Is the name of the machine where WebFOCUS is installed.

    For more details, see How to Save a Graph as an Image File.

  3. Run the procedure directly on the WebFOCUS Reporting Server, using a browser, or from Developer Studio.


x
Syntax: How to Save a Graph as an Image File
[FILEDEF filename DISK drive:\...\filename.fmt]
SET GRAPHSERVURL= graph_servlet_URL 
GRAPH FILE file 
graph commands 
ON GRAPH HOLD AS filename FORMAT fmt 
END

where:

FILEDEF

Saves the image file to the location you specify.

filename

Is the name you give the image file, which must match the FILEDEF command filename. If you want to prompt for a filename, include an amper variable such as &FILENAME in the procedure.

fmt

Is the type of image file in which to store the graph. Acceptable values are: PNG, SVG, GIF, or JPG.

graph_servlet_URL

Is the URL to invoke the WebFOCUS Graph Servlet. The maximum number of characters is 256.

file

Is the name of the data source you wish to report against.

Note: To insert an image that resides in a permanent location, you must provide the fully qualified path to the image file. For example, to insert a GIF file,

TYPE=REPORT, IMAGE=drive:\...\ filename.gif

where:

drive:\...\filename.gif

Is the path where the GIF file is located. The WebFOCUS Reporting server must be installed on that drive.



Example: Inserting a GIF Image Into a PDF Report

The following illustrates how you can create a GIF file from a graph request, and then embed the GIF image into a PDF report.

  1. Create the remote procedure in a location accessible to the EDA path or application path. For example, if you are running against your local server it may look like this:
    SET GRAPHSERVURL= http://localhost/ibi_apps/IBIGraphServlet
    GRAPH FILE CENTORD
    SUM LINEPRICE
    ACROSS PLANTLNG AS 'Plant'
    ON GRAPH HOLD AS PLANT FORMAT GIF
    END
    TABLE FILE CENTORD
    SUM LINEPRICE
    BY PLANTLNG AS 'Plant'
    ON TABLE SET STYLE *
    TYPE=REPORT, IMAGE=plant.gif, POSITION=(4 0), SIZE=(5 3), $
    ENDSTYLE
    ON TABLE PCHOLD FORMAT PDF
    END

    Note: If you are using JSCOM3, you can eliminate the SET GRAPHSERVURL parameter from the procedure.

  2. Save the procedure as HOLDGIF.
  3. Create an HTML file that calls the HOLDGIF WebFOCUS procedure from a hyperlink. For example,
    <HTML>
    <HEAD>
    <TITLE> Inserting a GIF Image in a PDF Report </TITLE>
    </HEAD>
    <BODY>
    <H4 ALIGN=CENTER>Report on Line Price by Plant</H4>
    <HR>
    <P><FONT SIZE=+2></FONT></P>
    <UL TYPE=SQUARE
    <LI><A HREF="http://localhost/ibi_apps/WFServlet?IBIF_ex=holdgif">
    <H4 ALIGN=CENTER>Click Here to Launch a PDF Report with an Embedded
        GIF Image</H4></A>
    </UL>
    </BODY>
    </HTML>

    The resulting launch page looks like this:

    You can now run the report from Developer Studio or from a browser. To distribute the report using ReportCaster, you would schedule the actual procedure, in this case HOLDGIF, to distribute the report.

  4. Click the link to run the report. The report looks like this:

Note: To run this procedure as a Managed Reporting Standard Report, add the -MRNOEDIT command to the beginning of the StyleSheet declaration containing the IMAGE attribute. This prevents Managed Reporting from looking for the GIF file in the Managed Reporting Repository. The image that is specified must reside on the WebFOCUS Reporting Server.

The -MRNOEDIT syntax is not case-sensitive and it can be used on a single line or a block of lines. For example:

Single line

-MRNOEDIT TYPE=REPORT, IMAGE=PLANT.gif, POSITION=(4 0), SIZE=(5 3), $

or

-MRNOEDIT TYPE=REPORT, IMAGE=PLANT.gif,
-MRNOEDIT POSITION=(4 0), SIZE=(5 3), $

Multiple lines

-MRNOEDIT BEGIN
TYPE=REPORT, IMAGE=PLANT.gif, POSITION=(4 0), SIZE=(5 3), $
-MRNOEDIT END


x
Reference: Usage Notes for Saving a Graph

If you selected the Save Report check box in the configuration pane of the WebFOCUS Administration Console (under Redirection Settings), you will be prompted whether to save or open the output file. If the procedure contained a PCHOLD command that specified an AS name for the output file, the name is retained if you choose to save the file. If no AS name was specified, a random filename is generated.

Important: You must do the following in the WebFOCUS Administration Console to utilize Save Report functionality for WebFOCUS GRAPH requests (specified with a PNG, SVG, GIF, or JPG format in the procedure):


WebFOCUS