Sign in to follow this  
Miodrag

How to save image from code

Recommended Posts

Hello,

I got problems with save images from code, in background, without user action:

Do you have some instructions how to do it and when I should call function saveAsImage()?

May I modify function saveAsImage(), for example with some arguments like saveAsImage(param)?

May I create web page dynamically with these images without saving them on file systems?

Regards,

Miodrag

Share this post


Link to post
Share on other sites

Hi,

Could you please try these solutions?

1: If you want to capture image of a chart without user interaction then you just need to invoke saveAsImage from FC_Rendered, (this method is called automatically when chart load it self completely). More information can be found here http://www.fusioncharts.com/Docs/Contents/JS_Overview.html .

Also could you please try using the following code:

<html>

 <head>  

  <script language="JavaScript" src="../../../JS/FusionCharts.js"></script> 

  <script LANGUAGE="JavaScript">

function FC_Rendered(domID)

{

  var chart= getChartFromId("Chart1");

  chart.saveAsImage();

}

  </script>

 </head>

 <body bgcolor="#ffffff"> 

  <div id="Div_YTDChart" align="center">The chart will appear within this DIV. This text will be replaced by the chart.</div>  

  <param name="allowScriptAccess" value="always" />

  <script type="text/javascript">  

var FChart = new FusionCharts("../../../V3/Column3D.swf?registerWithJS=1","Chart1","900","300","0","1");  

FChart.setDataURL("../xml/saveAsImage.xml");  

FChart.render("Div_YTDChart");

  </script>

 </body>

</html>

2: I am afraid, you can not modify the saveAsImage(), since this function a chart's function & it is exposed in JavaScript.

3: Yes, you could create a Web Page dynamically with the captured image, but to doing so, you need to change the code for the "FusionChartsSave.xxx", so that your chart's image appears directly on the page instead of opening a Save dialog box.

Edited by Guest

Share this post


Link to post
Share on other sites

In the sample HTML Code posted, where can we find the file 'saveAsImage.xml'? When the Chart.SaveAsImage() is executed, where is the Chart saved?

My requirement is that the Chart should be saved as a file in a pre-defined folder after it is displayd on screen so that I can access it while including the same in a PDF Report.

Share this post


Link to post
Share on other sites
Guest Basundhara Ghosal

Hi Venky,

Please try using the attribute "exportFileName" in the <chart> element to specify the name (excluding the extension) of the output (export) file.

Hope this helps. :)

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