Sign in to follow this  
farwest

save multiple charts to image with iframe, javascript function call doesn't work in firefox.

Recommended Posts

Hi,

 

 

 

I met a problem with saving multiple charts to image and then generate a pdf with the images. I put each of the charts into one iframe, and then when the user clicks on the generate pdf button, a javascript function try to call another javascript function (saveChart) in each of iframe page. (please see the codes below)

 

 

 

the problem is, it works fine with IE, but it doesn't work with firefox at all. I googled a lot and tried a lot diff things, but no luck with it. Anybody here get a idea what's wrong with it? Any input will be appreciated!

 

 

 

Regards,

 

Joe

 

 

 

 

 

 

-------------------------------------------------------------------------------

 

main page

 

 

 

< html>

 

< head>

 

< script language="JavaScript" type="text/javascript">

 

 

 

function saveCharts(){

 

 

 

top.iframe1.saveChart();

 

top.iframe2.saveChart();

 

top.iframe3.saveChart();

 

top.iframe4.saveChart();

 

top.iframe5.saveChart();

 

 

 

setTimeout('history.go(-1);', 9*1000 );

 

setTimeout('history.go(-1);', 9*1001 );

 

setTimeout('history.go(-1);', 9*1002 );

 

setTimeout('history.go(-1);', 9*1003 );

 

 

 

}

 

< /script>

 

 

 

< /head>

 

 

 

< iframe name="iframe1" id="iframe1" src ="fusionChart1.jsp" width="470px" height="250px">

 

< /iframe>

 

< iframe name="iframe2" id="iframe2" src ="fusionChart2.jsp" width="470px" height="250px">

 

< /iframe>

 

< iframe name="iframe3" id="iframe3" src ="fusionChart3.jsp" width="470px" height="250px">

 

< /iframe>

 

< iframe name="iframe4" id="iframe4" src ="fusionChart4.jsp" width="470px" height="250px">

 

< /iframe>

 

< iframe name="iframe5" id="iframe5" src ="fusionChart5.jsp" width="470px" height="250px">

 

< /iframe>

 

 

 

< a href="# " onclick="javascript:saveCharts();">DownLoad PDF< /a>

 

 

 

< /form>

 

< /body>

 

< /html>

 

 

 

-----------------------------------------------------------------------------------------------------

 

iframe page (fusionChart1.jsp ... fusionChart5.jsp)

 

 

 

< html>

 

< head>

 

< script language="JavaScript" type="text/javascript"

 

src="https://localhost:8443/bmw/js/FusionCharts.js">

 

< /script>

 

< script language="JavaScript" type="text/javascript">

 

 

 

function saveChart(){

 

var chartToPrint;

 

chartToPrint = getChartFromId('001');

 

chartToPrint.saveAsImage();

 

 

 

 

 

}

 

< /script>

 

< /head>

 

 

 

< body bgcolor="#ffffff">

 

< form action="" method="post">

 

< object classid="01" codebase="https://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="420" height="190" id="001" >

 

< param name="movie" value="../../charts/Scatter.swf" />

 

< param name="FlashVars" value="&registerWithJS=1&dataURL=../../charts/data_XYScatter.xml">

 

< param name="quality" value="high" />

 

< embed src="../../charts/Scatter.swf" flashVars="&registerWithJS=1&dataURL=../../charts/data_XYScatter.xml" quality="high" width="420" height="190" name="Column3D" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />

 

< /object>

 

 

 

< /form>

 

< /body>

 

< /html>

 

 

 

 

 

Share this post


Link to post
Share on other sites

Hi

Have you tried the latest export feature of FusionCharts v3?

If not, please do so whenever possible.

It will turn out to be easier to save the chart as image with this version than the earlier versions.

Hope this helps!  :blink:

Srividya

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