ActiveX - The DrawChart Component

Kristian Fiskerstrand's blog

Introduction

On these pages you will be able to find one of our ActiveX Components. This one was created to generate charts dynamicly on the fly in a Windows environment. It is design to be used from ASP pages running on a IIS webserver.

You can use this component to generate different types of charts. Horizontal bar chart, vertical bar chart, pie chart, and line series.

Examples

Horizontal bars Horizontal bars Vertical bars

Line series Pie chart

Initializing

To initialize the component you use: Set objChart = Server.CreateObject("DrawChart.Draw"), for this to be able to function you have to register the component, this you do with the regsvr32 command under NT. regsvr32 c:\DrawChart.dll as Administrator will register it. To unregister it use the /u flag.

Methods

The components has the following methods and members:

Width - Integer
The width of the image in pixels

Height - Integer
The height of the image in pixels

Style - Integer
1 - Horizontal bar,
2 - Vertical bar,
3 - Line series,
4 - Pie chart

Data - String
String in the format "something|something2|something3"

Values - String
The values in the format "1|2|3"

Title - String
The title

Color - String
The color of the chart - default: random - Look at page 5 for more info about colors

bgColor - String
Background color: default: white

wallColor - String
The wall color, only affected in 3d mode

Legend - Bool
weather you want to show the legend or not

view3d - Bool
set the 3d view

Stairs - Bool
only affected in style 3: line series, makes the lines go as stairs

Draw - Method
The method that draws the chart

Colors are reported in the Delphi style, therefore I have written a function that will convert hex-decimal colors (#000000) to delphi style:

Colors

    Function HexToDelphiColor(s)
     Dim c
     c = "$00" & Mid(s, 6, 2) & Mid(s, 4, 2) & Mid(s, 2, 2)
     HexToDelphiColor = c
    End Function

example of use: objChart.Color = HexToDelphiColor("#b0c4de")

Some pre-set values are also availible for the colors (only availible for the color member): blue, red, green, and random.

The component has been tested successfully under Windows 2000/IIS5 and Windows 2003 Server/IIS6. However, if you encounter any problems please contact us

ZIP FileSignature file Component [ZIP, 576 KiB] (Includes the PDF Whitepaper)
PDF FileWhitepaper [PDF, 259 KiB]
If you want access to the source code of this component (Delphi/pascal, compiled using Delphi 5), contact us. To use this component in commercial sites, also let us know.



[Sitemap]