tommytob

chartdata to javascript for server-sided jpeg export

Recommended Posts

I have looking for much solutions for server side export of the chart, so we can put it into a word document or something because we have over here the source code of the flash files, I have a look in the chart functions and came with this solution.

 

 

 

in the actionscript document chart.as.

 

 

 

is a function sendImageData

 

 

 

when you replace this line l.send(this.params.imageSaveURL, "_self", "POST");

 

into

 

fscommand("displayPost", l.data + "%,%"+l.width+"%,%"+l.height+"%,%"+l.bgcolor);

 

 

 

in the html document

 

 

 

in the head of the html document you should put this

 


<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />



 

for IE this must be in the document the %chartId% should contain the id of the chart

 


  <!--[if gte IE 5]>

	<script type="text/javascript" event="FSCommand(command,args)" for="%chartId%">

	$chartId%_DoFSCommand(command, args);

	</script>

<![endif]-->

 

and make a function in javascript

 


  function %chartID%_DoFSCommand(command, args) {

	if (command == "displayPost") {		

		var argArray = args.split('%,%');

		document.getElementById("data").value = argArray[0];

		document.getElementById("width").value = argArray[1];

		document.getElementById("height").value = argArray[2];

		document.getElementById("bgcolor").value = argArray[3];

		document.getElementById('fusion').submit();

	}

} 

 

and make a form in the html document

 


  <form name="fusion" id="fusion" method="POST" action="FusionChartsSave.php">

<input type="hidden" name="data" id="data" value="">

<nput type="hidden" name="height" id="height" value="">

<input type="hidden" name="width" id="width" value="">

<input type="hidden" name="bgcolor" id="bgcolor" value="">

  </form>

 

 

 

in the fusionChart.js

 

you should put this swliveconnect=true into the embed function

 

 

 

the chartdata is now available in javascript and in php so I can put the image now in my word document

 

 

 

 

 

I have made a new function so the save image is still available for the user but this is just a example how to do.

Edited by Guest

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now