[These pages contain ready ASP scripts. You can use them in your own applications]

Building line chart from recordset

Note: all scripts examples included in these Web pages are absolutely free. You can copy, use, and modify these scripts anyway you want. The scripts are published without warranty of any kind.

 Download the ASP source with database example (48Kb)

Description

ShotGraph contains a number of functions for drawing graphic primitives on the imagespace. These examples use some of those functions to build the chart. This requires a little of ASP programming, however, you can customize your chart anyway as you want.
Every SQL chart example consists of two ASP scripts: the main ASP script (this ASP script creates HTML document) and image generating ASP script (this script is linked with main by <IMG SRC> tag).

Two possible solutions

There are two possible solutions to build a chart from database data:
1.
If the size of recordset is short, the best way is to retrieve data from database and process the data in the main (HTML generating) ASP script and pass all required data from recordset for the chart as parameters of script in the <IMG SRC>. The advantage of this way is you can draw a several charts from one recordset. This solution is realized in the short.asp example included in the package.
2.
If chart is built from big amount of data (the size of recordset is long), you can not pass all data as parameters in the consequence of fact that the maximal size of parameters string is limited. In this case there is the universal solution:
You can retrieve the data from database and process the data directly in the image generating script.

The ASP scripts from this example draw the following charts:

Short recordset

Long recordset

Back to examples