Sign in to follow this  
rohitg

Save image as not working

Recommended Posts

I am trying to invoke the saveImage using java script,

 

 

 

function saveChart(catId)

 

{

 

var chartId = "chart"+catId;

 

var ch = getChartFromId(chartId);

 

ch.saveAsImage();

 

}

 

 

 

This doesn't seem to be working when I use the "createChartHTML" present in the FusionChart.jsp page, but the saveimage in the right click context menu is working.

 

 

 

However if I use "createChart" method in the same file, it works, but I am scenario I need to use the html method, since they whole chart object comes in the AJAX response.

 

 

 

Could you please tell me what I can do to archive this.

 

 

 

Regards,

 

Rohit

Share this post


Link to post
Share on other sites

Can anyone from fusion charts team answer this, coz this is important for me.

 

 

 

Please let me know if this cannot be achieved and there is a bug or anything.

 

 

 

Regards,

 

Rohit

Share this post


Link to post
Share on other sites

Hi,

 
You would need to modify the FusionCharts.jsp file as below:
 
  public String createChartHTML(String chartSWF, String strURL,

String strXML, String chartId, int chartWidth, int chartHeight,

boolean debugMode) {

/*Generate the FlashVars string based on whether dataURL has been provided

  or dataXML.*/

String strFlashVars = "";

Boolean debugModeBool = new Boolean(debugMode);

 

if (strXML.equals("")) {

  //DataURL Mode

  strFlashVars = "chartWidth=" + chartWidth + "&chartHeight="

+ chartHeight + "&debugMode=" + boolToNum(debugModeBool)

+ "&dataURL=" + strURL + "";

} else {

  //DataXML Mode

  strFlashVars = "chartWidth=" + chartWidth + "&chartHeight="

+ chartHeight + "&debugMode=" + boolToNum(debugModeBool)

+ "&dataXML=" + strXML + "";

}

 
  strFlashVars = strFlashVars + "&registerWithJS=1";

StringBuffer strBuf = new StringBuffer();

 
The registerWithJS=1 parameter is required when you are working with JavaScript ExternalInterface i.e. saveAsImage();.
 

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