ChartDirector 6.0 (ASP/COM/VB Edition)

Simple Radar Chart




This example demonstrates the basic steps in creating radar charts.

Source Code Listing

[Web Version (in ASP)] aspdemo\simpleradar.asp
<%@ language="vbscript" %>
<%
Set cd = CreateObject("ChartDirector.API")

' The data for the chart
data = Array(90, 60, 65, 75, 40)

' The labels for the chart
labels = Array("Speed", "Reliability", "Comfort", "Safety", "Efficiency")

' Create a PolarChart object of size 450 x 350 pixels
Set c = cd.PolarChart(450, 350)

' Set center of plot area at (225, 185) with radius 150 pixels
Call c.setPlotArea(225, 185, 150)

' Add an area layer to the polar chart
Call c.addAreaLayer(data, &H9999ff)

' Set the labels to the angular axis as spokes
Call c.angularAxis().setLabels(labels)

' Output the chart
Response.ContentType = "image/png"
Response.BinaryWrite c.makeChart2(cd.PNG)
Response.End
%>

[Windows Version (in Visual Basic)] vbdemo\simpleradar.cls
Public Sub createChart(viewer As Object, chartIndex As Integer)

    Dim cd As New ChartDirector.API

    ' The data for the chart
    Dim data()
    data = Array(90, 60, 65, 75, 40)

    ' The labels for the chart
    Dim labels()
    labels = Array("Speed", "Reliability", "Comfort", "Safety", "Efficiency")

    ' Create a PolarChart object of size 450 x 350 pixels
    Dim c As PolarChart
    Set c = cd.PolarChart(450, 350)

    ' Set center of plot area at (225, 185) with radius 150 pixels
    Call c.setPlotArea(225, 185, 150)

    ' Add an area layer to the polar chart
    Call c.addAreaLayer(data, &H9999ff)

    ' Set the labels to the angular axis as spokes
    Call c.angularAxis().setLabels(labels)

    ' Output the chart
    Set viewer.Picture = c.makePicture()

    'include tool tip for the chart
    viewer.ImageMap = c.getHTMLImageMap("clickable", "", "title='{label}: score = {value}'")

End Sub