ASP Chart Walk-Through, adding charts to your web site

[ ASP Server-Side IIS Development ]

The following demonstrates how to create your first ASP Charts 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).

Installation...

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:

PEGRP32F.DLL

ProEssentials Pro DLL
PEGO32F.OCX Graph Object
PESGO32F.OCX Scientific Graph Object
PE3DO32F.OCX 3D Scientific Graph Object
PEPSO32F.OCX Polar Object
PEPCO32F.OCX Pie Chart Object
PE8API.INC ProEssentials ASP Include File
 

PEGRPSF.DLL

ProEssentials Standard DLL
PEGOSF.OCX Graph Object
PESGOSF.OCX Scientific Graph Object
PE3DOSF.OCX 3D Scientific Graph Object
PEPSOSF.OCX Polar Object
PEPCOSF.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 or syswow64 dir on 64 bit systems. 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 Chart HTML Source.

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

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 Chart VBScript Source in NotePad.exe

<%
dim myobj
Set myobj = server.CreateObject("PEGOF.Pegofctrl.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)
    next
next
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, PEGOE.Pegoectrl.1 is the ClassID for the ProEssentials Graph Object. Note, Standard users use PEGOFSTD.PegofStdCtrl.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 a PNG with VBScript and ASP Chart...

Asp Chart 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. Chapter 2's .NET Reference is the best mechanism to navigate the large quantity of properties and features.  Walk-Throughs of .NET charting in VB.NET, C#.NET, ASP, VC, VB6, and Delphi get you started quickly.

learn more about our Asp Chart, see Chapter 3

Online interactive demo

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

view our online .Net Chart Demo

Letter from the President

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

Thank you