Swiff Chart Generator runs in conjunction with Swiff Chart, the desktop chart authoring tool for creating chart templates. Chart templates (aka chart styles) include all the graphical, layout and format parameters for all individual chart elements
In the simple example below, the chart is created using one of the predefined chart templates distributed with Swiff Chart Generator.
For more information about Swiff Chart see How to specify chart format and layout parameters.
Let's take as an example the following data and make the following animated chart.
January | February | March | April | |
---|---|---|---|---|
Total Revenues | 187 | 110 | 159 | 261 |
The chart above can be dynamically generated with the following ASP.NET 2.0 code and page.
ASP.NET 2.0 page: SampleWebForm.aspx.cs
ASP.NET 2.0 page: SampleWebForm.aspx
The chart above can be dynamically generated with the following VBScript code:
<% @Language=VBScript %> <% ' Create a Chart Object Dim chart Set chart= Server.CreateObject("SwiffChartObject.ChartObj") ' Set dynamic data chart.SetTitle "Total Revenues" chart.SetCategoriesFromString "January;February;March;April" chart.SetSeriesValuesFromString 0, "187;110;159;261" ' Load a chart template (aka chart style). ' The chart template contains all the format and layout parameters of the chart. ' Use Swiff Chart authoring tool to edit a custom chart template. chart.LoadStyle "column\SanFrancisco" ' Finally generate the chart Response.Write chart.GetHTMLTag Set chart= Nothing %>
The chart above can be dynamically generated with the following PHP code:
<?php // Create a Chart Object require("SwiffChart.php"); $chart= new SwiffChart; // Set dynamic data $chart->SetTitle("Total Revenues"); $chart->SetCategoriesFromString("January;February;March;April"); $chart->SetSeriesValuesFromString( 0, "187;110;159;261" ); // Load a chart template (aka chart style). // The chart template contains contains all the format and layout parameters of the chart. // Use Swiff Chart authoring tool to edit a custom chart template. $chart->LoadStyle("column/SanFrancisco"); // Finally generate the chart echo $chart->GetHTMLTag(); ?>
The chart above can be dynamically generated with the following JSP code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Chart Sample</title> </head> <body> <%@page language="java"%> <%@page import="com.globfx.swiffchart.SwiffChart" %> <% String install_dir= "/usr/local/SwiffChart"; SwiffChart chart= new SwiffChart(install_dir); chart.SetDocumentRoot( getServletContext().getRealPath("/") ); chart.SetAppRootUrl(request.getContextPath()); chart.SetServletInfo(request,response); // Set dynamic data chart.SetTitle("Total Revenues"); chart.SetCategoriesFromString("January;February;March;April"); chart.SetSeriesValuesFromString( 0, "187;110;159;261" ); // Load a chart template (aka chart style). // The chart template contains contains all the format and layout parameters of the chart. // Use Swiff Chart authoring tool to edit a custom chart template. chart.LoadStyle("column/SanFrancisco"); // Finally generate the chart and release the object out.println( chart.GetHTMLTag() ); chart.Release(); %> </body> </html>
The chart above can be dynamically generated with the following command line:
C:\> swfchart.exe /O sample.swf /S column\SanFrancisco /T "Total Revenues" /D ";" /C "January;February;March;April" /N "187;110;159;261" where: /O specifies the output filename of the generated 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 column\SanFrancisco /D ";" /O sample.swf C:\data.txt
$ swfchart -o sample.swf -s column/SanFrancisco -t "Total Revenues" -d ";" -c "January;February;March;April" -n "187;110;159;261" where: -o specifies the output filename of the generated 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 column/SanFrancisco -d ";" -o sample.swf /home/user/data.txt