Asp Graph, ASP ActiveX example code and Walk-Through

[ ASP Server-Side IIS Development ]

The following demonstrates your first ASP Graph implementation. It discusses using ASP to serve up a dynamically generated PNG image. Other examples are provided within this website and the product/evaluation. For more information, refer to the "Readme.htm" and "AspReadMe.htm" files installed onto your system with the eval/product (accessible via Start menu).


When installing the ProEssentials evaluation and/or product, the setup program installs the ProEssentials DLL and ActiveX interfaces into the system directory. Files relevant to ASP development are:


ProEssentials Pro DLL
PEGOG.OCX Graph Object
PESGOG.OCX Scientific Graph Object
PE3DOG.OCX 3D Scientific Graph Object
PEPSOG.OCX Polar Object
PEPCOG.OCX Pie Chart Object
PE8API.INC ProEssentials ASP Include File


ProEssentials Standard DLL
PEGOSG.OCX Graph Object
PESGOSG.OCX Scientific Graph Object
PE3DOSG.OCX 3D Scientific Graph Object
PEPSOSG.OCX Polar Object
PEPCOFS.OCX Pie Chart Object
PE8API.INC ProEssentials ASP Include File

The setup program also registers the ActiveXs with the operating system which prepares IIS for creating ProEssentials components. You can manually register an ActiveX with "REGSVR32.EXE" found in your system/system32 dir. You can also use this utility to manually un-register an ActiveX by using the "-u" command. Un-Registering is useful when you want to test CAB download/installation issues on your development machine.

myfirst.htm / myfirst.asp Serving up a PNG...

ASP Graph html source in NotePad.exe

<P>Run ASP Server Script via IMG src</P>
<IMG src = "myfirst.asp">

Open Notepad and enter the code shown to the left.

For simplicity, we recommend the IMG src line reference just a file name, with no path, but make sure to save files into the wwwroot dir.

Name this file "MyFirst.htm". Your server's local root directory is commonly C:\Inetpub\wwwroot.

This simple web page contains a single line paragraph followed by an image. The image's src is pointing to an ASP page "MyFirst.asp" which causes server-side code to execute and send back the image in a binary stream, ideal for web-farm environments.

myfirst.htm / myfirst.asp Serving up a PNG...

ASP Graph asp source in NotePad.exe

dim myobj
Set myobj = server.CreateObject("PEGOG.Pegogctrl.1")
myobj.MainTitle = "Hello Internet"
myobj.SubTitle = ""
myobj.PrepareImages = True
myobj.Subsets = 4
myobj.Points = 12
dim i
dim j
for i = 0 to 3
    for j = 0 to 11
       myobj.YData(i,j) = 5 + Rnd(20)
Response.BinaryWrite (myobj.PNGToStream(300,300))
Set myobj = Nothing

Using NotePad, create another file called "MyFirst.asp" and enter the corresponding code shown to the left.

Again, save this file into your web server's local root directory as you did with "MyFirst.htm".

Note the entire contents of "MyFirst.asp" are within <% ... %> tags. Make sure no spaces or ascii exist before or after tags!!!!!

"MyFirst.asp" contains ASP code (VBScript) which creates a ProEssentials component via the CreateObject method. CreateObject's only argument is a ClassID. In this case, PEGOD.Pegodctrl.1 is the ClassID for the ProEssentials Graph Object. Note, Standard users use PEGOGSTD.PegogStdCtrl.1

Next, the code sets the control's MainTitle and SubTitle properties.

Next, Subsets and Points properties are set and define the amount of data the control will contain.

Then, a nested for-next loop passes 48 random data points into the YData(s,p) two dimensional property array.

Next, FontSize is set to 0 which denotes large font. You will likely use our ProEssentials ASP Include file and then prototype your ASP code within Visual Basic. This lets you copy and paste your Visual Basic code directly into an ASP page because the include file holds the declarations for property enumerations.

myfirst.htm / myfirst.asp Serving up an ASP Graph with VBScript...

Asp Graph within your Browser!

Finally, the Response.BinaryWrite ASP function retrieves a stream of image data from the ProEssentials PNGToStream method and passes it to the client's browser.

If you point your internet browser towards the file "MyFirst.htm", you will see a page similar to that shown to the left.

Refer to the "ASP Readme" file accessed via the Start menu to see more examples, including, rendering as an ActiveX, automatic downloading the ActiveX, client-side event scripting, and more.


Online developer reference

Complete online technical reference to the ProEssentials product. Our .NET Reference is the best mechanism to navigate the large quantity of properties and features.  Walk-Throughs of charting in VB.NET, C#.NET, ASP, VC, and Delphi get you started quickly.

learn more about ASP, Chapter 3, Asp.NET is Chapter 2

Online interactive demo

Interactive Financial, Engineering, Scientific, and Business examples give you an instant taste of ProEssentials' power.

view our Asp.Net Graph Demo

Letter from the President

Thank you for researching. Call, email and let's talk charting.

Thank you