Data and Result

Let's take as an example the following data and make the following animated chart.

How to generate the chart in VBScript

The chart above can be dynamically generated with the following simple VBScript code:

<% @Language=VBScript %>
<%
  'Create a Chart Object 
  Dim chart
  Set chart= Server.CreateObject("SwiffChartObject.ChartObj.1")

  'Set dynamic data 
  chart.SetTitle "Movie Revenues"
  chart.SetCategoriesFromString "Harry Potter;Monsters, Inc.;Lord of the Rings"
  chart.AddSeries
  chart.SetSeriesValuesFromString 0, "187.8;156.9;121.8"

  'Load a chart style 
  chart.LoadStyle "pie\Geneva2"

  'Generate the Flash movie 
  chart.ExportAsResponse
  Response.End
%>

How to generate the chart in Javascript

The chart above can be dynamically generated with the following simple Javascript code:

<% @Language=JScript %>
<%
  // Create a Chart Object 
  var chart = Server.CreateObject("SwiffChartObject.ChartObj.1");

  // Set dynamic data 
  chart.SetTitle("Movie Revenues");
  chart.SetCategoriesFromString("Harry Potter;Monsters, Inc.;Lord of the Rings");
  chart.AddSeries();
  chart.SetSeriesValuesFromString( 0, "187.8;156.9;121.8" );

  // Load a chart style 
  chart.LoadStyle("pie\\Geneva2");

  // Generate the Flash movie 
  chart.ExportAsResponse();
  Response.End();
%>

How to generate the chart in PHP

The chart above can be dynamically generated with the following simple PHP code:

<?php
  // Create a Chart Object 
  require("SwiffChart.php");

  $chart= new SwiffChart;

  // Set dynamic data 
  $chart->SetTitle("Movie Revenues");
  $chart->SetCategoriesFromString("Harry Potter;Monsters, Inc.;Lord of the Rings");
  $chart->AddSeries();
  $chart->SetSeriesValuesFromString( 0, "187.8;156.9;121.8" );

  // Load a chart style 
  $chart->LoadStyle("pie/Geneva2");

  // Generate the Flash movie 
  $chart->ExportAsResponse();
?>

How to generate the chart from command line

The chart above can be dynamically generated with the following simple command line:


Windows:
C:\> swfchart.exe /O sample.swf /S pie\Geneva2 /T "Movie Revenues" /D ";" /C "Harry Potter;Monsters, Inc.;Lord of the Rings" /N "187.8;156.9;121.8"

where:
  /O  specifies the output filename of the generated SWF chart
  /S  specifies the chart style name (or direct filename)
  /T  specifies the chart title
  /D  specifies the delimiters to use
  /C  specifies the categories names (separators-delimited)
  /N  specifies the data series (separators-delimited)

Data may also be read from a file:

C:\> swfchart.exe /S pie\Genevas2 /D ";" /O sample.swf C:\data.txt


Unix:
$ swfchart -o sample.swf -s pie/Geneva2 -t "Movie Revenues" -d ";" -c "Harry Potter;Monsters, Inc.;Lord of the Rings" -n "187.8;156.9;121.8"

where:
  -o  specifies the output filename of the generated SWF chart
  -s  specifies the chart style name (or direct filename)
  -t  specifies the chart title
  -d  specifies the delimiters to use
  -c  specifies the categories names (separators-delimited)
  -n  specifies the data series (separators-delimited)

Data may also be read from a file:

$ swfchart -s pie/Genevas2 -d ";" -o sample.swf /home/user/data.txt