Use flashchart to generate a bar chart in the php Tutorial
Recently, a bar chart, pie chart, and trend chart similar to excel needs to be generated...
Google some online, found the Open Flash Chart address: http://teethgrinder.co.uk/open-flash-chart-2.
A very useful open-source tool. The latest version is 2.0.
---------------------------
Http://ofcgwt.googlecode.com/svn/demo/Demo.html there are many examples for reference here.
However, we do not recommend using the sample code on googlecode. We recommend using the official sample code and flash chart.
Flash chart is easy to use.
Example:
// Url format
Function embSwfWithUrl (dataurl, divcon ){
Var params = {
"Wmode": "transparent ",
"Menu": "false ",
"Scale": "noScale ",
"AllowFullscreen": "false ",
"AllowScriptAccess": "always ",
"Bgcolor": "# c0c0c0" // background
};
Var flashvars = {
'Data-file': dataurl
};
Swfobject. embedSWF ("/swf/open-flash-chart.swf? Timestamp = "+ Math. random (), divcon," 450 "," 300 "," 10.0.0 ","./swf/expressInstall.swf ", flashvars, params );
}
EmbSwfWithUrl ('http: // xxx.com/xxx.html', 'swfcon'); here, http://xxx.com/xxx.htmlreturns the corresponding JSON data.
SwfCon is a div container for flash.
Swfobject is an open source js class for processing flash. Http://code.google.com/p/swfobject/
---------------------------
Note that there are two ways to obtain data from flash charts,
One is data-file and the other is get-data.
Data-file is exactly the same as in the preceding example. The value must be a url address and json data is returned.
The get-data value is a function name. The function returns json data.
Example:
// Get-data
Function embSwfWithData (divcon, getdataFn ){
Var params = {
"Wmode": "transparent", // window mode
"Menu": "false", // menu display
"Scale": "noScale", // scale
"AllowFullscreen": "false", // allow full screen
"AllowScriptAccess": "always", // allow scripts
"Bgcolor": "# c0c0c0" // background
};
Var flashVar = {
"Get-data": getdataFn
};
Swfobject. embedSWF ("/swf/open-flash-chart.swf? Timestamp = "+ Math. random (), divcon," 450 "," 300 "," 10 ","/swf/expressInstall.swf ", flashVar, params );
}
Function getJsonData (){
Return 'json data ';
} Here "get-data": getdataFn