<%
@LANGUAGE="VBSCRIPT" %>
<%
'***************** Example:
Data-Visualization-Charts-1.asp **********************
'
' CRT Quality Analysis Data Visualization
' Written by eMarkSoft Inc. on 2002.04.29
'
'*********************************************************
%>
<%
Server.ScriptTimeout = 900
' Create a Graphing Object
Set obj=Server.CreateObject("eMarkASI.Painter")
obj.CreateImage 550,400
'draw background grid
obj.PenColor = "#CCCCCC"
obj.LineTo 0,399
obj.LineTo 549,399
obj.LineTo 549,0
obj.LineTo 0,0
obj.PenColor = "#333333"
obj.Rectangle 20,20,420,380
a1=100
b1=90
for i=1 to
3
obj.MoveTo 20+i*a1,20
obj.LineTo 20+i*a1,380
obj.MoveTo 20,20+i*b1
obj.LineTo 420,20+i*b1
next
' Drawing legend
obj.MoveTo 470,85
obj.LineTo 470,110
obj.LineTo 495,110
obj.Textout "25um","Black",5,495,105,1
obj.Textout "R: õ","Red",5,480,200,1
obj.Textout "G: ð","Green",5,480,240,1
obj.Textout "B: ÷","Blue",5,480,280,1
' Draw the random chart
for i=0
to 4
for
j=0 to 4
' Get random data
Randomize
rx=Int(12 * Rnd)*((-1)^Int(2 * Rnd))
ry=Int(12 * Rnd)*((-1)^Int(2 * Rnd))
gx=Int(12 * Rnd)*((-1)^Int(2 * Rnd))
gy=Int(12 * Rnd)*((-1)^Int(2 * Rnd))
bx=Int(12 * Rnd)*((-1)^Int(2 * Rnd))
by=Int(12 * Rnd)*((-1)^Int(2 * Rnd))
obj.PenColor = "Red"
DrawSquare1 20+i*a1,20+j*b1,rx,ry,10,obj
obj.PenColor = "Green"
DrawEllipse1 20+i*a1,20+j*b1,gx,gy,10,obj
obj.PenColor = "Blue"
DrawTriangle1 20+i*a1,20+j*b1,bx,by,10,obj
next
next
Response.ContentType = "image/png"
Response.BinaryWrite obj.Png Function
DrawTriangle1(x0,y0,x,y,s,obj) 'x0,y0
is center coordinate of the triangle
dim Points(2,3),a,b
a = round ((2*sqr(s*s-s*s/4))/3)
b = round (a/2)
Points(0,0) = x0+x
Points(1,0) = y0-y-a
Points(0,1) = x0+x-(s/2)
Points(1,1) = y0-y+b
Points(0,2) = x0+x+(s/2)
Points(1,2) = y0-y+b
obj.MoveTo Points(0,0),Points(1,0)
obj.Polygon Points
'draw a short line
dim Ax,Ay
Ax= x0+x
Ay= y0-y
obj.MoveTo Ax,Ay
obj.LineTo x0,y0
End function '-------------
Function DrawSquare1(x0,y0,x,y,s,obj)
'x0,y0 is center coordinate
of the rectangle
dim Points(2,2)
Points(0,0) = x0+x-(s/2)
Points(0,1) = y0-y-(s/2)
Points(1,0) = x0+x+(s/2)
Points(1,1) = y0-y+(s/2)
obj.Rectangle Points(0,0),Points(0,1),Points(1,0),Points(1,1)
'draw a short line
dim Ax,Ay
Ax= x0+x
Ay= y0-y
obj.MoveTo Ax,Ay
obj.LineTo x0,y0
End function '-------------
Function DrawEllipse1(x0,y0,x,y,d,obj)
'x0,y0 is center coordinate
of the ellipse
dim Points(2,2)
Points(0,0) = x0+x-(d/2)
Points(0,1) = y0-y-(d/2)
Points(1,0) = x0+x+(d/2)
Points(1,1) = y0-y+(d/2)
obj.Ellipse Points(0,0),Points(0,1),Points(1,0),Points(1,1)
'draw a short line
dim Ax,Ay
Ax= x0+x
Ay= y0-y
obj.MoveTo Ax,Ay
obj.LineTo x0,y0
End function '================
%> |