Generates the chart as an image, saves it to a session variable and returns query parameters for loading the image.
The makeSession method is designed to support web applications in which the chart is generated in the script that outputs HTML.
This method requires session variables be enabled in the web server, which should be the default for IIS servers.
HTML cannot "contain" any image. It can only contain the URL of the images, typically in <IMG> tags. Other tags, such as <IFRAME>, <OBJECT> or <EMBED>, or the "background" property of CSS, etc, can also be used. The browser will use the URLs to load the images from separate HTTP connections.
In the followings, for conciseness, we will use <IMG> in the description. It should be noted that the description applies to other tags that can load chart images.
As HTML cannot contain any image, the script that outputs HTML cannot output the chart image. It needs to save the image in some place, and output an <IMG> tag with an URL for retrieving the saved image.
To save the chart image, a common method is to save it to the hard disk. The URL to load the image is then the URL of the image file. Please refer to BaseChart.makeTmpFile
if you would like to consider this method.
The makeSession method saves images in session variables, avoiding creating image files on the hard disk. The makeSession method returns a URL query string, which can be used with a ChartDirector utility script "getchart.asp" to load the image from session variables.
To avoid having to save the chart image at all, an alternative approach is to put the URL of a script in the <IMG>. The browser will then access the script to load the image. The script can generate the chart image and streamed directly to the browser. In this case, the chart is not generated by the script that outputs HTML, but by another script that handles the <IMG> tag.
A limitation of this method is that the charts cannot use image maps. Image maps are HTML tags (<MAP> and <AREA> tags) and can only be outputted by the script that generates HTML. If image maps are used, the charts need to be generated in the script that outputs HTML.
In a typical application, the chart is created like:
query1 = c.makeSession(Session, "chart1")
The web page then includes an <IMG> tag as follows:
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.
A string representing the query parameters for retrieving the image using "getchart.asp".
© 2017 Advanced Software Engineering Limited. All rights reserved.