ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  Analog Clock using AngularMeter for ASP Classic
Posted by mohamed nour on Oct-17-2014 15:11
Any tried making realtime Analog Clock using AngularMeter using ASP Classic?

  Re: Analog Clock using AngularMeter for ASP Classic
Posted by Peter Kwan on Oct-18-2014 02:53
Attachments:
Hi mohamed,

I have just modified the "Multi-Pointer Angular Meter" so that its two pointers reflect the hour and minute values.  The code is included below. Please modify it according to your own needs (eg. add a pointer for the second values, add a background image, change color and size, etc). You may use it as the charting code of the "realchartchart.asp" so that it would be used by the "realtimedemo.asp" for the Realtime Chart.

Hope this can help.

Regards
Peter Kwan


<%@ language="vbscript" %>
<%
Set cd = CreateObject("ChartDirector.API")

' Create an AugularMeter object of size 200 x 200 pixels
Set m = cd.AngularMeter(200, 200)

' Use white on black color palette for default text and line colors
Call m.setColors(cd.whiteOnBlackPalette)

' Set the meter center at (100, 100), with radius 85 pixels, and span from 0 to 360
' degress
Call m.setMeter(100, 100, 85, 0, 360)

' Meter scale is 0 - 100, with major tick every 10 units, minor tick every 5 units,
' and micro tick every 1 units
Call m.setScale2(0, 360, Array("12", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11"))

' Set angular arc, major tick and minor tick line widths to 2 pixels.
Call m.setLineWidth(2, 2, 2)

' Add a blue (9999ff) ring between radii 88 - 90 as decoration
Call m.addRing(88, 90, &H9999ff)

' Add a text label centered at (100, 70) with 12 pts Arial Bold font
Call m.addText(100, 70, "PSI", "arialbd.ttf", 12, cd.TextColor, cd.Center)

currentTime = Now

Call m.addPointer((Hour(currentTime) + Minute(currentTime) / 60) * 30, &H806666ff, &H6666ff).setShape(cd.TriangularPointer, 0.7)

' Add a semi-transparent red (80FF6666) pointer using the arrow shape
Call m.addPointer(Minute(currentTime) * 6, &H80ff6666, &Hff6666).setShape(cd.TriangularPointer)

' Output the chart
Response.AddHeader "Cache-Control", "max-age=1"
Response.ContentType = "image/png"
Response.BinaryWrite m.makeChart2(cd.PNG)
Response.End
%>
clock.png