ChartDirector 7.0 (ASP/COM/VB Edition)

Built-In Symbols




This example demonstrates the built-in symbols supported by ChartDirector.

Source Code Listing

[Web Version (in ASP)] aspdemo\builtinsymbols.asp
<%@ language="vbscript" %> <% Set cd = CreateObject("ChartDirector.API") ' Some ChartDirector built-in symbols symbols = Array(cd.CircleShape, cd.GlassSphereShape, cd.GlassSphere2Shape, cd.SolidSphereShape, _ cd.SquareShape, cd.DiamondShape, cd.TriangleShape, cd.RightTriangleShape, _ cd.LeftTriangleShape, cd.InvertedTriangleShape, cd.StarShape(3), cd.StarShape(4), _ cd.StarShape(5), cd.StarShape(6), cd.StarShape(7), cd.StarShape(8), cd.StarShape(9), _ cd.StarShape(10), cd.PolygonShape(5), cd.Polygon2Shape(5), cd.PolygonShape(6), _ cd.Polygon2Shape(6), cd.Polygon2Shape(7), cd.CrossShape(0.1), cd.CrossShape(0.2), _ cd.CrossShape(0.3), cd.CrossShape(0.4), cd.CrossShape(0.5), cd.CrossShape(0.6), cd.CrossShape( _ 0.7), cd.Cross2Shape(0.1), cd.Cross2Shape(0.2), cd.Cross2Shape(0.3), cd.Cross2Shape(0.4), _ cd.Cross2Shape(0.5), cd.Cross2Shape(0.6), cd.Cross2Shape(0.7), cd.ArrowShape(), cd.ArrowShape( _ 45), cd.ArrowShape(90, 0.5), cd.ArrowShape(135, 0.5, 0.2), cd.ArrowShape(180, 0.3, 0.2, 0.3), _ cd.ArrowShape(225, 1, 0.5, 0.7), cd.ArrowShape(270, 1, 0.5, 0.25), cd.ArrowShape(315, 0.5, _ 0.5, 0), cd.ArrowShape(30, 0.5, 0.1, 0.6), cd.ArrowShape(210, 0.5, 0.1, 0.6), cd.ArrowShape( _ 330, 0.7, 0.1), cd.ArrowShape(150, 0.7, 0.1)) ' Create a XYChart object of size 500 x 450 pixels Set c = cd.XYChart(500, 450) ' Set the plotarea at (55, 40) and of size 400 x 350 pixels, with a light grey border (0xc0c0c0). ' Turn on both horizontal and vertical grid lines with light grey color (0xc0c0c0) Call c.setPlotArea(55, 40, 400, 350, -1, -1, &Hc0c0c0, &Hc0c0c0, -1) ' Add a title to the chart using 18pt Times Bold Itatic font. Call c.addTitle("Built-in Symbols", "Times New Roman Bold Italic", 18) ' Set the axes line width to 3 pixels Call c.xAxis().setWidth(3) Call c.yAxis().setWidth(3) ' Ensure the ticks are at least 1 unit part (integer ticks) Call c.xAxis().setMinTickInc(1) Call c.yAxis().setMinTickInc(1) ' Add each symbol as a separate scatter layer. For i = 0 To UBound(symbols) Call c.addScatterLayer(Array(i Mod 7 + 1.0), Array(Int(i / 7) + 1.0), "", symbols(i), 17) Next ' Output the chart Set viewer = cd.WebChartViewer(Request, "chart1") Call viewer.setChart(c, cd.SVG) ' Include tool tip for the chart viewer.ImageMap = c.getHTMLImageMap("", "", "title='(x, y) = ({x}, {value})'") %> <!DOCTYPE html> <html> <head> <title>Built-in Symbols</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;"> Built-in Symbols </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>

[Windows Version (in Visual Basic)] vbdemo\builtinsymbols.cls
Public Sub createChart(viewer As Object, chartIndex As Integer) Dim cd As New ChartDirector.API ' Some ChartDirector built-in symbols Dim symbols() symbols = Array(cd.CircleShape, cd.GlassSphereShape, cd.GlassSphere2Shape, _ cd.SolidSphereShape, cd.SquareShape, cd.DiamondShape, cd.TriangleShape, _ cd.RightTriangleShape, cd.LeftTriangleShape, cd.InvertedTriangleShape, cd.StarShape(3), _ cd.StarShape(4), cd.StarShape(5), cd.StarShape(6), cd.StarShape(7), cd.StarShape(8), _ cd.StarShape(9), cd.StarShape(10), cd.PolygonShape(5), cd.Polygon2Shape(5), _ cd.PolygonShape(6), cd.Polygon2Shape(6), cd.Polygon2Shape(7), cd.CrossShape(0.1), _ cd.CrossShape(0.2), cd.CrossShape(0.3), cd.CrossShape(0.4), cd.CrossShape(0.5), _ cd.CrossShape(0.6), cd.CrossShape(0.7), cd.Cross2Shape(0.1), cd.Cross2Shape(0.2), _ cd.Cross2Shape(0.3), cd.Cross2Shape(0.4), cd.Cross2Shape(0.5), cd.Cross2Shape(0.6), _ cd.Cross2Shape(0.7), cd.ArrowShape(), cd.ArrowShape(45), cd.ArrowShape(90, 0.5), _ cd.ArrowShape(135, 0.5, 0.2), cd.ArrowShape(180, 0.3, 0.2, 0.3), cd.ArrowShape(225, 1, _ 0.5, 0.7), cd.ArrowShape(270, 1, 0.5, 0.25), cd.ArrowShape(315, 0.5, 0.5, 0), _ cd.ArrowShape(30, 0.5, 0.1, 0.6), cd.ArrowShape(210, 0.5, 0.1, 0.6), cd.ArrowShape(330, _ 0.7, 0.1), cd.ArrowShape(150, 0.7, 0.1)) ' Create a XYChart object of size 500 x 450 pixels Dim c As XYChart Set c = cd.XYChart(500, 450) ' Set the plotarea at (55, 40) and of size 400 x 350 pixels, with a light grey border ' (0xc0c0c0). Turn on both horizontal and vertical grid lines with light grey color (0xc0c0c0) Call c.setPlotArea(55, 40, 400, 350, -1, -1, &Hc0c0c0, &Hc0c0c0, -1) ' Add a title to the chart using 18pt Times Bold Itatic font. Call c.addTitle("Built-in Symbols", "timesbi.ttf", 18) ' Set the axes line width to 3 pixels Call c.xAxis().setWidth(3) Call c.yAxis().setWidth(3) ' Ensure the ticks are at least 1 unit part (integer ticks) Call c.xAxis().setMinTickInc(1) Call c.yAxis().setMinTickInc(1) ' Add each symbol as a separate scatter layer. Dim i As Long For i = 0 To UBound(symbols) Call c.addScatterLayer(Array(i Mod 7 + 1.0), Array(Int(i / 7 + 1.0)), "", symbols(i), 17) Next ' Output the chart Set viewer.Picture = c.makePicture() 'include tool tip for the chart viewer.ImageMap = c.getHTMLImageMap("clickable", "", "title='(x, y) = ({x}, {value})'") End Sub