Path: C:\
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
Persistable = 0 'NotPersistable
DataBindingBehavior = 0 'vbNone
DataSourceBehavior = 0 'vbNone
MTSTransactionMode = 0 'NotAnMTSObject
END
Attribute VB_Name = "polarvector"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Explicit
'Number of charts produced in this demo module
Public Function getNoOfCharts() As Integer
getNoOfCharts = 1
End Function
'Main code for creating chart.
'Note: the argument img is unused because this demo only has 1 chart
Public Sub createChart(viewer As Object, img As String)
Dim cd As New ChartDirector.API
' Coordinates of the starting points of the vectors
Dim radius()
radius = Array(5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 10, 10, 10, 10, 10, 10, 10, _
10, 10, 10, 10, 10, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 20, 20, _
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 25, 25, 25, 25, 25, 25, 25, 25, 25, _
25, 25, 25)
Dim angle()
angle = Array(0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330, 0, 30, 60, _
90, 120, 150, 180, 210, 240, 270, 300, 330, 0, 30, 60, 90, 120, 150, 180, _
210, 240, 270, 300, 330, 0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, _
330, 0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330)
' Magnitude and direction of the vectors
Dim magnitude()
magnitude = Array(5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, _
4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, _
2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
Dim direction()
direction = Array(60, 90, 120, 150, 180, 210, 240, 270, 300, 330, 0, 30, 60, _
90, 120, 150, 180, 210, 240, 270, 300, 330, 0, 30, 60, 90, 120, 150, 180, _
210, 240, 270, 300, 330, 0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, _
330, 0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330, 0, 30)
' Create a PolarChart object of size 460 x 460 pixels
Dim c As PolarChart
Set c = cd.PolarChart(460, 460)
' Add a title to the chart at the top left corner using 15pts Arial Bold Italic
' font
Call c.addTitle("Polar Vector Chart Demonstration", "arialbi.ttf", 15)
' Set center of plot area at (230, 240) with radius 180 pixels
Call c.setPlotArea(230, 240, 180)
' Set the grid style to circular grid
Call c.setGridStyle(False)
' Set angular axis as 0 - 360, with a spoke every 30 units
Call c.angularAxis().setLinearScale(0, 360, 30)
' Add a polar vector layer to the chart with blue (0000ff) vectors
Call c.addVectorLayer(radius, angle, magnitude, direction, cd.RadialAxisScale, _
&H0000ff)
' Output the chart
Set viewer.Picture = c.makePicture()
'include tool tip for the chart
viewer.ImageMap = c.getHTMLImageMap("clickable", "", _
"title='Vector at ({value}, {angle} deg): Length = {len}, Angle = {dir} deg'")
End Sub