The Swiff Chart Generator provides you with an efficient way to specify data to a chart directly from a HTTP query. To create a chart using data specified in a HTTP query, you must build a URL referencing an ASP page (or a PHP page if you are using PHP). This URL should also include additionnal parameters that actually contains the necessary data for building the chart. These parameters must be specifically formatted for the Swiff Chart Generator.
The following example shows a URL specifically formatted for the Swiff Chart Generator. The URL contains data for generating charts on the web server.
http://www.mysite.com/chart.asp?title=My Chart&categories=Categ1;Categ2;Categ3&captions=First Series&series1=1.5;2.7;3.8
Various parameters can be passed to the Swiff Chart Generator. Each of them must be separated with an ampersand character (&). The syntax for parameters is as follows:
http://<server>/<file>?<parameter>=<value string>&...&<parameter>=<value string>
Here are the parameters that can be passed to the Swiff Chart Generator:
Parameter | Value String |
---|---|
title | A string that specifies the title of the chart |
series1 series2 series3 ... |
A character-delimited string that specifies a new series to be added to the chart. The string contains the values of the new series. |
seriesxy1 seriesxy2 seriesxy3 ... |
A character-delimited string that specifies a new XY series to be added to the chart. The string
contains the set of value pairs of the new XY series formatted as follows: x1 y1 x2 y2 ... xn yn
Note: This key is to be used when manipulating XY data series required for displaying XY-Curves and XY-Scatter. |
captions | A character-delimited string that specifies the captions of the series in the chart. |
categories | A semicolon-delimited (";") string that specifies the categories of the chart. |
animate | A boolean value that specifies whether the chart is animated. Can be true or false. |
width | An integer value that specifies the width in pixels of the generated Flash movie. |
height | An integer value that specifies the height in pixels of the generated Flash movie. |
fps | An integer value that specifies the frame rate in frames per second of the generated Flash movie. |
For example, the URL below will be interpreted as follows:
http://www.mysite.com/chart.asp?title=My Chart&categories=Categ1;Categ2;Categ3&captions=First Series&series1=1.5;2.7;3.8&animate=true
The following HTML page named "ShowSwiffChart.html" runs in conjunction with the corresponding ASP page named "ShowSwiffChart.asp". To run this example, copy the HTML code into an HTML page.
FILE: ShowSwiffChart.html <HTML> <HEAD><TITLE>Display Swiff Chart animation</TITLE></HEAD> <BODY> This page will display a Swiff Chart animation dynamically generated from an ASP page.<BR> <OBJECT ALIGN=CENTER WIDTH=430 HEIGHT=150 CLASSID="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" CODEBASE="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0"> <PARAM NAME=movie VALUE="ShowSwiffChart.asp?title=Monthly Revenues&categories=Jan;Feb;Mar&captions=First Year&series1=11.8;12.7;11.9&animate=true"> <PARAM NAME=quality VALUE=high> <EMBED SRC="ShowSwiffChart.asp?title=Monthly Revenues&categories=Jan;Feb;Mar&captions=First Year&series1=11.8;12.7;11.9&animate=true" WIDTH=430 HEIGHT=150 QUALITY=high PLUGINSPAGE="http://www.adobe.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash"> </EMBED> </OBJECT> </BODY> </HTML>
The following ASP page named "ShowSwiffChart.asp" runs in conjunction with the corresponding HTML page named "ShowSwiffChart.html". To run this example, copy the ASP code into an ASP page named "ShowSwiffChart.asp".
FILE: ShowSwiffChart.asp <%@ LANGUAGE="VBSCRIPT" %> <% Dim chart ' Create a new Swiff Chart object. Set chart= Server.CreateObject("SwiffChartObject.ChartObj") ' Fill the chart with data stored in the query string chart.SetSeparators ";", true chart.SetDataFromQuery ' The following load line assumes you have created a Swiff Chart style file named myStyle.scs chart.LoadStyle "C:\myStyle.scs" ' Finally generate the Flash chart and provide the browser with it chart.ExportAsResponse ' Release the chart object Set chart= Nothing Response.End %>
Creating a Chart Using Data Specified in Arrays
Creating a Chart Using Data Specified in Strings
Creating a Chart Using Data From a Text File
Creating a Chart Using Data From an ADO Recordset