Sign in to follow this  
Ganesh

Saving image - corrupt saved chart file

Recommended Posts

We are trying to generate a JPEG image using the latest trial download (V3.0.6), but we are finding that image is getting saved in the server side we are using the JSP (FusionChartsSave.jsp). The saved file size is 69 KB. But we are not able to do preview or open it in the paint (it gives an error message Paint cannot read this file). Is there any encoding that we need to do?

Please find the javascript code that we have used below. Any inputs on what could be the reason for file corruption would be great.

  <script language="JavaScript">
  var sdrDivChart = new FusionCharts("Column2D.swf", "sdrDivID", "600", "400", "0", "1");
   <!--Initialize graph with chart data returned by generateXMLforSDR() function. [ note: the parameter 'this.document.productSelector.AnimateChart.checked' is passed to set animation property of the chart]
  //loading XML data into variable strXML -->
  var strXML=generateXMLforSDR();
  alert(strXML);
  sdrDivChart.setDataXML(strXML);
  sdrDivChart.render("sdrDiv");
 </script>
 <BR />
 <center><input type='button' value='Save Chart as Image' onClick='javascript:saveChart();'></center>
  <SCRIPT LANGUAGE="JavaScript">
    function saveChart(){
	   //Get chart from its ID
	   var chartToPrint = getChartFromId("sdrDivID");
	   alert("Before SaveASImage Method");
	   chartToPrint.saveAsImage();
	   alert("After SaveASImage Method");
    }
  </SCRIPT>

Edited by Guest

Share this post


Link to post
Share on other sites

Does this work for the all kinds of graph is there any restriction on the type of graph? Like Area Graph and Stacked bar and others?

 

 

 

From the code it looks like the graph is re-generated back in the server side once again.

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
Sign in to follow this