ASP Graphing & Charting Component

Examples

 ASP Line Charts
 ASP Bar Charts
 Pie Charts
 ASP Data Visualization Chart
 ASP Professional Statistics Chart

Download

 Help File (108KB)
 ASIHelp.chm

 Full Trial (1.69MB)
 asidemo.zip
   
 

ActiveX/Component Library

 Active Server Flash








 



ASP Graphing & Charting Software Source Code

Pie Charts Shots

ASP Pie Charts with 6 Fields
ASP Pie Charting with 6 Fields
Custom ASP Pie Charts with 4 Fields

Pie Charts Example Source Code

<% @LANGUAGE="VBSCRIPT" %>
<%
'***************** Example: Pie-Charts.asp **********************
'
' Use Active Server Image to Create Custom Charts
' ASP Charts --- Pie
' Written by eMarkSoft Inc. on 2002.04.29
'
'*********************************************************

Server.ScriptTimeout = 900

'Amount of Pie-Shape
n = 4

Radian = 3.1416/180 'Radian = pi/180

'Create random data
Dim Colors
Redim Colors(10)
Dim Datas
Redim Datas(n,2)

Colors(0) = "Blue"
Colors(1) = "chartreuse"
Colors(2) = "blueviolet"
Colors(3) = "gold"
Colors(4) = "indianred"
Colors(5) = "lightblue"
Colors(6) = "maroon"
Colors(7) = "olive"
Colors(8) = "red"
Colors(9) = "steelblue"

Randomize

Total = 0

for i=0 to n-1

Datas(i,0) = "Field"&Cstr(i)
Datas(i,1) = Round(rnd*1000)
Total = Total + Datas(i,1)
next

'Create a Graphing Object to Draw the Chart
Set obj=Server.CreateObject("eMarkASI.Painter")

obj.CreateImage 540,440
obj.SetCanvasColor "#F0F0F0"

PLeft = 20
PTop = 40
PRight = 380
PBottom = 400
R = Round((PRight - PLeft)/2) 'Radius

P3X = PRight    'The X Point at the positon of 3 o'clock
P3Y = PBottom - R
P12X = PRight - R
P12Y = PTop    'The Y Point at the positon of 12 o'clock
P9X = PLeft
P9Y = PTop + R
P6X = PLeft + R
P6Y = PBottom

x1 = P3X
y1 = P3Y
CurrAngle = 0

TextHeight = obj.TextHeight("xx")
obj.MoveTo P3X+30,P12Y
obj.BrushStyle = 0
obj.Textout "Total: "&Total,,12,,,1

'Draw n-1 pie-shape along counterclockwise
for i=0 to n-2

x0 = x1
y0 = y1
Angle = Round((Datas(i,1)/Total)*360)
CurrAngle = CurrAngle + Angle

if CurrAngle < 45 then
x1 = P3X
y1 = P3Y - Round(Tan(Radian*(CurrAngle))*R)
elseif CurrAngle < 90 then
x1 = P12X + Round(Tan(Radian*(90-CurrAngle))*R)
y1 = P12Y
elseif CurrAngle < 135 then
x1 = P12X - Round(Tan(Radian*(CurrAngle-90))*R)
y1 = P12Y
elseif CurrAngle < 180 then
x1 = P9X
y1 = P9Y - Round(Tan(Radian*(180-CurrAngle))*R)
elseif CurrAngle < 225 then
x1 = P9X
y1 = P9Y + Round(Tan(Radian*(CurrAngle - 180))*R)
elseif CurrAngle < 270 then
x1 = P6X - Round(Tan(Radian*(270-CurrAngle))*R)
y1 = P6Y
elseif CurrAngle < 315 then
x1 = P6X + Round(Tan(Radian*(CurrAngle - 270))*R)
y1 = P6Y
else
x1 = P3X
y1 = P3Y + Round(Tan(Radian*(360-CurrAngle))*R)
end if
obj.BrushStyle = 0

obj.MoveTo P3X+30,P12Y+(i+3)*TextHeight
obj.Textout " "&Datas(i,0)&": "&Cstr(Datas(i,1))& " (" &FormatPercent(Datas(i,1)/Total)& ")","black"

obj.BrushColor = Colors(i)
obj.BrushStyle = 1
obj.Pie PLeft,PTop,PRight,PBottom,x0,y0, x1,y1
call rect(P3X+30,P12Y+(i+3)*TextHeight)
next

'Draw the last pie-shape

obj.BrushStyle = 0

obj.MoveTo P3X+30,P12Y+(i+3)*TextHeight
obj.Textout " "&Datas(i,0)&": "&Cstr(Datas(i,1))& " (" &FormatPercent(Datas(i,1)/Total)& ")","black"

obj.BrushColor = Colors(i)
obj.BrushStyle = 1
obj.Pie PLeft,PTop,PRight,PBottom,x1,y1, P3X,P3Y
call rect(P3X+30,P12Y+(i+3)*TextHeight)

'output the Chart

Response.ContentType = "image/png"
Response.BinaryWrite obj.Png

sub Rect(xx,yy)

'Use to Draw a legend square
obj.BrushStyle = 1
obj.RectAngle xx,yy+2,xx+10,yy+10
obj.BrushStyle = 0
end sub
%>