Home  >  Article  >  Backend Development  >  PHP flashchart histogram generation example

PHP flashchart histogram generation example

WBOY
WBOYOriginal
2016-07-25 08:55:331133browse
  1. //url form
  2. function embSwfWithUrl(dataurl,divcon){
  3. var params = {
  4. "wmode": "transparent",
  5. "menu": "false",
  6. "scale" : "noScale",
  7. "allowFullscreen": "false",
  8. "allowScriptAccess": "always",
  9. "bgcolor": "#c0c0c0" //Background
  10. };
  11. var flashvars = {
  12. 'data-file' : dataurl
  13. };
  14. swfobject.embedSWF("/swf/open-flash-chart.swf?timestamp=" + Math.random(),divcon, "450", "300", "10.0.0", "./ swf/expressInstall.swf",flashvars,params);
  15. }
  16. embSwfWithUrl('http://xxx.com/xxx.html','swfCon');http://xxx.com/xxx.html here returns is the corresponding data in json format.
Copy code

swfCon is a div container for flash. swfobject is an open source js class for processing flash: http://code.google.com/p/swfobject/

Note: There are two ways to obtain data from flash chart, One is data-file and the other is get-data. data-file is just like the above example, the value must be a url address, and the json data returned inside. The value of get-data is a function name. The function returns json data.

Example:

  1. //get-data
  2. function embSwfWithData(divcon,getdataFn){
  3. var params = {
  4. "wmode": "transparent", //Window mode
  5. "menu": "false ", //Menu display
  6. "scale": "noScale", //Scale
  7. "allowFullscreen": "false", //Allow full screen
  8. "allowScriptAccess": "always", //Allow script
  9. "bgcolor": " #c0c0c0" //Background
  10. };
  11. var flashVar = {
  12. "get-data":getdataFn
  13. };
  14. swfobject.embedSWF("/swf/open-flash-chart.swf?timestamp=" + Math.random( ), divcon, "450", "300", "10", "/swf/expressInstall.swf",flashVar ,params);
  15. }
  16. function getJsonData(){
  17. return 'json data';
  18. }Here "get -data”:getdataFn
Copy code


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn