ASP basics for reports with graphics
To produce a custom report in the form of a graph, you must create an ASP that:
- Changes the HTTP header so the browser will know that image data is being passed, rather than HTML.
- Creates the report object.
- Specifies an initial size for the graph.
- Generates an HTML image tag that references the image source, or saves the image in binary format.
- Sends the image tag or the binary information to the browser.
The following example shows these elements. Note that it also explicitly declares the variables that will be used, and clears the report object when done.
<%
Response.Expires = -1
Response.Buffer = TRUE
'Clear out the existing HTTP header information and
'change the HTTP header to reflect that an image is
'being passed (rather than HTML)
Response.Clear
Response.ContentType = "IMAGE/JPEG"
'Create the report object
set obj = Server.CreateObject("PFReportObj.PFRptObject")
'Initialize the graph
'(nAxisStyle is determined by the InForm application’s 'underlying charting tool)
obj.SetGraphDisplay nChartType, nAxisStyle, nSize, nSize
'Get an HTML image tag
strImage = obj.ImageHTML nSize, nSize
'Write the image to the browser
Response.Write(strImage)
set obj = nothing
%>