ChartDirector 7.0 (ASP/COM/VB Edition)
Icon Angular Meter
Source Code Listing
<%@ language="vbscript" %>
<%
Set cd = CreateObject("ChartDirector.API")
' The value to display on the meter
value = 85
' Create an AugularMeter object of size 70 x 90 pixels, using black background with a 2 pixel 3D
' depressed border.
Set m = cd.AngularMeter(70, 90, 0, 0, -2)
' Set default directory for loading images from current script directory
Call m.setSearchPath(Server.MapPath("."))
' Use white on black color palette for default text and line colors
Call m.setColors(cd.whiteOnBlackPalette)
' Set the meter center at (10, 45), with radius 50 pixels, and span from 135 to 45 degrees
Call m.setMeter(10, 45, 50, 135, 45)
' Set meter scale from 0 - 100, with the specified labels
labels = Array("E", " ", " ", " ", "F")
Call m.setScale2(0, 100, labels)
' Set the angular arc and major tick width to 2 pixels
Call m.setLineWidth(2, 2)
' Add a red zone at 0 - 15
Call m.addZone(0, 15, &Hff3333)
' Add an icon at (25, 35)
Call m.addText(25, 35, "<*img=gas.png*>")
' Add a yellow (ffff00) pointer at the specified value
Call m.addPointer(value, &Hffff00)
' Output the chart
Set viewer = cd.WebChartViewer(Request, "chart1")
Call viewer.setChart(m, cd.SVG)
%>
<!DOCTYPE html>
<html>
<head>
<title>Icon Angular Meter</title>
<!-- Include ChartDirector Javascript Library to support chart interactions -->
<script type="text/javascript" src="cdjcv.js"></script>
</head>
<body style="margin:5px 0px 0px 5px">
<div style="font:bold 18pt verdana;">
Icon Angular Meter
</div>
<hr style="border:solid 1px #000080; background:#000080" />
<div style="font:10pt verdana; margin-bottom:1.5em">
<a href="viewsource.asp?file=<%= Request("SCRIPT_NAME") %>">View Chart Source Code</a>
</div>
<!-- ****** Here is the chart image ****** -->
<%= viewer.renderHTML() %>
</body>
</html>
Public Sub createChart(viewer As Object, chartIndex As Integer)
Dim cd As New ChartDirector.API
' The value to display on the meter
Dim value As Double
value = 85
' Create an AugularMeter object of size 70 x 90 pixels, using black background with a 2 pixel 3D
' depressed border.
Dim m As AngularMeter
Set m = cd.AngularMeter(70, 90, 0, 0, -2)
' Use white on black color palette for default text and line colors
Call m.setColors(cd.whiteOnBlackPalette)
' Set the meter center at (10, 45), with radius 50 pixels, and span from 135 to 45 degrees
Call m.setMeter(10, 45, 50, 135, 45)
' Set meter scale from 0 - 100, with the specified labels
Call m.setScale2(0, 100, Array("E", " ", " ", " ", "F"))
' Set the angular arc and major tick width to 2 pixels
Call m.setLineWidth(2, 2)
' Add a red zone at 0 - 15
Call m.addZone(0, 15, &Hff3333)
' Add an icon at (25, 35)
Call m.addText(25, 35, "<*img=gas.gif*>")
' Add a yellow (ffff00) pointer at the specified value
Call m.addPointer(value, &Hffff00)
' Output the chart
Set viewer.Picture = m.makePicture()
End Sub