Sign in to follow this  

Export Chart Asynchronously

Recommended Posts



I am trying to export fusion chart serverside using javascript to initiate the export.


The chart to be exported resides on say Deatils.aspx page. The chart is rendered by using the following code

FusionCharts.RenderChartHTML("../FusionCharts/MSCombiDY2D.swf", _url, "", "details_chart", "730", "350", false);


where _url is GenerateGraph.aspx, this page renders the graph asynchronously i.e the parent page Details.aspx will continue to render other objects while the chart is loaded paralelly.


Now to export the chart the user clicks a link button, on its "OnClientClick", the following javascript function is called which resides on the Details.aspx page


// this function exports chart
   function exportChart(exportFormat) {
       if (FusionCharts("details_chart").exportChart) {
             document.getElementById("linkToExportedFile").innerHTML = "Exporting...";
           FusionCharts("details_chart").exportChart({ "exportFormat": exportFormat });
       else {
            document.getElementById("linkToExportedFile").innerHTML = "Please wait till the chart completes rendering...";


but the above javascript function throws an error saying that it could not find the "details_chart" object, quite understandably as the whole chart rendering is being taken by GenerateGraph.aspx.


In the above scenario how do i do i export the graph??? Is there a way or workaround to get the chart object and javascript exports normally?. I will not be able to render the graph on the Details.aspx itself, (which would solve the problem), as it will block the whole page's loading until graph renders and it is totally unacceptable from user's perspective.


Awaiting advice and solutions from you guys.




Edited by Cheiro

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