ChartDirector 7.0 (ASP/COM/VB Edition)



makeSession(sess, name[, imageFormat ])


Generates the chart as an image, saves it to a session variable and returns query parameters for loading the image.

Note: This method is designed to address the limitation of older HTML standard that only allows the <IMG> tag to contain the URL of an image, but the image itself. The browser, after receiving the HTML, will need to connect to the URL with a separate HTTP connection to get the image.

The HTML was designed that way because when the web was invented, people were still using 2400 bps modem. Loading an image could be very slow, and the network connection was charged on a per minute basis. It was better to see the text first, and load the image later via separate connections. Earlier browsers even allowed users to disable loading images entirely.

Nowadays all browsers support embedding the images in HTML. Network speed is much faster that viewing video is common. Newer ChartDirector sample code no longer use this API.

The makeSession method is designed to support web applications in which the chart is generated in the same script that generates the HTML.

Older HTML standard that only allows the the <IMG> tag to contain the URL of an image, but the image itself. The browser, after receiving the HTML, will need to use a separate HTTP connection to get the image. That means the script that generates the HTML with the chart image cannot put the chart image in the web page. One way is to save the chart image as a file using a unique filename, and then include the url of that image file in the <IMG> tag. This would create many files on the server and another mechanism is needed to clean up old files.

The makeSession method saves the image in a session variable, avoiding creating image files on the hard disk. Almost all web servers today support session variables. The server will destroy the session variable when the user session ends, usually after a period of no activity.

The makeSession method returns query parameters to allow the image to be loaded with the ChartDirector utility script "getchart.asp".

In a typical application, the chart is created like:

query1 = c.makeSession(Session, "chart1")

The web page then includes an <IMG> tag as follows:

<IMG SRC="getchart.asp?<%=query1%>">

Note that the above assumes "getchart.asp" is in the same directory as your script. If it is in a different directory, you would need to modify the path in the <IMG> tag.


sess(Mandatory)The session object of an IIS Active Server Page.
name(Mandatory)The name of the session variable used to store the chart image. If there are multiple chart images in the same web page, each image must use a different name.
imageFormatPNGA constant representing the format of the image. Must be one of the predefined constants PNG, JPG, GIF, BMP, WMP, SVG, SVGZ or PDF.

Return Value

A string representing the query parameters for retrieving the image using "getchart.asp".