hide side navigation
    5 most recent
    Web Services
  Flash Spell Checker  Company information and news  LinkToMe  Flash Google MX  Flash Currency Conversion  Language Translation  Flash Server Inspector  Stock Quotes in Flash  Flash 2D and 3D charts
    Library's
    Component's
    Applications
    Articles
Update: Ming is no longer supported on this server, so this service will not work. If anyone is interested in the code for this service, please visit us on the message board.

Example Output, Clients, and Usage
Provides a dynamically created SWF Chart based on options specified in your web service client. Returns a base64 binary file that you can either display or save to your file system. For service specific details visit the service listing in the Flash-db service directory. Their are some example clients below - you will have to decode the base64 returned element before using.
Dynamically create 2D and 3D Flash Charts as a Web Service
This service allows anyone regardless of programming language to easily create dynamic and highly configurable 2D and 3D animated Flash Bar Charts. This service is meant as more of an Example and working Demonstration of combining 3 very important projects (PHP, Ming, and Nusoap). So lets start off with the credits - as all I did on this one was turn it into a distributable service that anyone can use. After looking over the usage below you'll have a better understanding of what this is doing.

Credit : without which this service would not be possible
About
Basically this service allows you to specify a bunch of options in your web services Client, then the request is sent to this service where the server creates the graph according to your input. A base64 binary data file is sent back to the client. You can save this file (Highly suggested) or directly display it. This service is an example and demonstration only. It can not be used on a commercial site, and we can not gaurentee that the service will always be available, theirfore it is recommended that you save the returned binary file to your file system for future use.

Usage
Input Parameters (may add more in the future)
Parameter Description
mainTitle Main Title on Top of Chart
subTitle Smaller title under Main Title
xAxisTitle x Axis Title
yAxis Title y Axis Title
sourceTitle Data Source Title - Lower right side
minValue Minimum Value of Data Range (usually 0)
maxValue Maximum Value of Data Range (usually 100)
unitType The type of units your working in (usually %)
drawGrid Has value of 1 or 0. 1 specifies to draw grid, 0 not to.
animate Has value of 1 or 0. 1 specifies to Animate Chart, 0 for no animation.
show3D Has value of 1 or 0. 1 specifies to draw grid in 3D
dataArray String of Values you wish to Graph. The dataArray is formatted as: Apples:78.5,Oranges:34.8,Peaches:23.7, for example. With the Name and Value seperated by a semi-colon, and each pair seperated by a comma.


Example Clients, I'll try to put up an ASP.net client here shortly. For now they are all in PHP, but of cource you can make a Client for this service with any Toolkit in any language (hopefully).

All clients will need to decode the base64 data back to Binary for use. The PHP Client examples assume you have Nusoap working. Check the services directory here on Flash-db for more info.

PHP Client which Saves Result to file System
<?php
// Require Nusoap..
require_once('nusoap.php');

// Define input parts. (change the input strings for your custom graph).
$parameters = array(

	"mainTitle"		=>"My Bar Chart Title",
	"subTitle"		=>"Example SubTitle",	
	"xAxisTitle"		=>"x Axis Title",
	"yAxisTitle"		=>"y Axis Title",
	"sourceTitle"		=>"Source: Example Output from Service",		
	"minValue"		=>"0",
	"maxValue"		=>"100",
	"unitType"		=>" %",	
	"drawGrid"		=>"1",
	"animate"			=>"1",
	"show3D"			=>"1",
	"dataArray"   		=>"Apples:78.5,Oranges:34.8,Peaches:23.7,Pears:12.9"
);

// Specify path to WSDL
$soapclient = new soapclient('http://www.flash-db.com/services/ws/flashBarChart.wsdl', 'wsdl');

// Specify Method/Operation and call service
$result 	= $soapclient->call('doFlashBarChart',$parameters);

// Decode returned base64 binary data.
$binary = base64_decode($result);

// Specify Chart Name and Location to save to.
$movieName = "../myCharts/NewChart.swf";

// Write the Binary Data to the location specified above.
$fp = fopen($movieName,"w"); 
fwrite($fp, $binary, 12000); 
fclose( $fp );
?>
The above example saves a chart to your file system on your server. Make sure to make the Directory you are saving the Flash Chart to is Writable. To embed this movie in an HTML page you can use the following:
<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
 codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0"
  WIDTH="500" HEIGHT="400">
 <PARAM NAME=movie VALUE="NewChart.swf"> 
 <PARAM NAME=quality VALUE=high> 
 <PARAM NAME=bgcolor VALUE=#FFFFFF> 
 <EMBED src="NewChart.swf" quality=high bgcolor=#FFFFFF  WIDTH="500" HEIGHT="400"
 TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer">
 </EMBED>
</OBJECT>
As an alternative you can also use the Flash 'loadMovie' command to load the generated Chart into an existing Flash movie and display it their.

PHP Client which Outputs Directly to page
<?php
// Require Nusoap..
require_once('nusoap.php');

// Define input parts. (change the input strings for your custom graph).
$parameters = array(

	"mainTitle"		=>"My Bar Chart Title",
	"subTitle"		=>"Example SubTitle",	
	"xAxisTitle"		=>"x Axis Title",
	"yAxisTitle"		=>"y Axis Title",
	"sourceTitle"		=>"Source: Example Output from Service",		
	"minValue"		=>"0",
	"maxValue"		=>"100",
	"unitType"		=>" %",	
	"drawGrid"		=>"1",
	"animate"			=>"1",
	"show3D"			=>"1",
	"dataArray"   		=>"Apples:78.5,Oranges:34.8,Peaches:23.7,Pears:12.9"
);

// Specify path to WSDL
$soapclient = new soapclient('http://www.flash-db.com/services/ws/flashBarChart.wsdl', 'wsdl');

// Specify Method/Operation and call service
$result 	= $soapclient->call('doFlashBarChart',$parameters);

// Specify Content type so browser knows what to expect, 
// may not correctly output in all browsers.  But by embedding this (next) it will work in all.
header('Content-type: application/x-shockwave-flash');

// Decode base64 data.
$binary = base64_decode($result);

// Print out binary data.
print $binary;

?>
You can (and should) directly Embed the output from the Above Client in the object and embed tags. This probably will not output correctly to your browser if you do not embed the above client in the standard Flash tags in an HTML page.
<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
 codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0"
  WIDTH="500" HEIGHT="400">
 <PARAM NAME=movie VALUE="http://www.mySite.com/myClientScript.php"> 
 <PARAM NAME=quality VALUE=high> 
 <PARAM NAME=bgcolor VALUE=#FFFFFF> 
 <EMBED src="http://www.mySite.com/myClientScript.php" 
 quality=high bgcolor=#FFFFFF  WIDTH="500" HEIGHT="400"
 TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer">
 </EMBED>
</OBJECT>
Well that's about it. I'll try to put up some clients for other programming languages in the near future. Until then if you have any questions, find a bug, or something isn't working for you be sure to visit the Flash-db Message Boards.

Service Producer: Jeff Hill