woodykiddy

Exportchart() Function Doesn't Work At All!

Recommended Posts

I was going to export chart to image and save it on the server. But it just didn't work. I believe there must be an error / a problem with the following js function:

 

var chartObject = FusionCharts("myChartId");

chartObject.exportChart(); // <= it fails badly

 

This then causes the problem on the Export Handler, which will produce the following server error:

 

DOMId=

height=0

width=0

fileName=

statusMessage=Insufficient data.

statusCode=0

 

 

As far as I understand, it is saying that the chart stream data has not been posted to the server (i.e. Request["stream"] is NULL ), which is why the export handler doesn't recognise the chart and save it to image.

 

This issue has been bugging me for many hours, and I have tried looking for solutions on the forum but all in vain. So please kindly advise a proper solution to this issue. Thanks.

 

EDIT:

 

By the way, I have also tried both .NET chart export handlers with correct configurations, but no luck getting chart exported.

Edited by woodykiddy

Share this post


Link to post
Share on other sites
Guest Sumedh

Hi :)

 

Apologies for the delay.

 

I am afraid, I am unable to comprehend the issue.

 

Can you send us, relevant sample code of your issue?

 

It would be helpful for us to look into the issue.

Edited by Sumedh

Share this post


Link to post
Share on other sites

Hi :)

 

Apologies for the delay.

 

I am afraid, I am unable to comprehend the issue.

 

Can you send us, relevant sample code of your issue?

 

It would be helpful for us to look into the issue.

 

I basically used the same piece of code as the one we saw in the FusionCharts Doc.

 

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
   <title>Untitled Page</title>
   <script type="text/javascript" src="Charts/FusionCharts.js"></script>
   <script type="text/javascript">
       function ExportMyChart() {
           //var chartObject = getChartFromId('myChartId');
           var chartObject = FusionCharts("myChartId");
           //alert(chartObject.getXMLData());  //test to see if chartObject created or not
           if (chartObject.hasRendered()) chartObject.exportChart();
       }

     </script>
</head>
<body>
   <div id="chartContainer">FusionCharts will load here!</div>          

   <script type="text/javascript">
       var myChart = new FusionCharts("Charts/Column3D.swf", "myChartId", "400", "300", "0", "1");
       myChart.setXMLUrl("Charts/Data.xml");
       myChart.render("chartContainer");
   </script>

   <script type="text/javascript">
       //Callback handler method which is invoked after the chart has saved image on server.
       function FC_Exported(objRtn) {
           if (objRtn.statusCode == "1") {
               alert("The chart was successfully saved on server. The file can be accessed from " + objRtn.fileName);
           } else {
               alert("The chart could not be saved on server. There was an error. Description : " + objRtn.statusMessage);
           }
       }
   </script>        
   <input type="button" onclick="ExportMyChart()"
       value="Export Chart to Image" id="btnExportChart" />
</body>
</html>

 

 

And XML code for chart attributes

<chart exportHandler="http://mywebsite/Charts/ExportHandlers/ASP_Net11/FCExporter.aspx" exportEnabled="1" exportAtClient="0" exportAction="save" caption="Sales Summary" subCaption="For the year 2010" numberPrefix="$" sformatNumberScale="1" sNumberPrefix="$" syncAxisLimits="1" rotateValues="1" showSum="0">

 

But somehow it just doesn't export properly. I wonder, would there be any restrictions to call exportChart() JS function? Why it doesn't send stream to .NET export handler?

 

Share this post


Link to post
Share on other sites
Guest Sumedh

Hi :)

 

Could you please download the latest version of FusionCharts i.e FusionCharts XT Service Release 2

 

Please refer the following link for download:

http://www.fusioncha...ownload/trials/

 

Also try to use new ExportHandlers from FusionCharts XT Service Release 2 version.

 

And see if this helps?

 

Hope you have a great day. :)

Share this post


Link to post
Share on other sites

Hi :)

 

Could you please download the latest version of FusionCharts i.e FusionCharts XT Service Release 2

 

Please refer the following link for download:

http://www.fusioncha...ownload/trials/

 

Also try to use new ExportHandlers from FusionCharts XT Service Release 2 version.

 

And see if this helps?

 

Hope you have a great day. :)

 

Can you please attach fusioncharts.js file directly in here? My fusionCharts.js version is fusioncharts/3.2.3-release.4749. Not sure if it's the latest version or not.

 

Also I re-downloaded the latest version, but still that didn't solve my problem. I got the same error messages returned from export handler:

 

DOMId=
height=0
width=0
fileName=
statusMessage=Insufficient data.statusCode=0

 

 

I don't understand what else I am missing here. :(

Edited by woodykiddy

Share this post


Link to post
Share on other sites
Guest Sumedh

Hi. :)

 

I am afraid, I could not replicate the same.

 

exportChart() function is working fine at our end.

 

Please note that, you would need to provide proper path for the FCExporter file in the exportHandler attribute of XML file.

 

Also, you would need to modify the path for (private const string HTTP_URI ="Desired path to locate export handler file") variable in the FCExporter.aspx file.

 

Please find attached screenshot, XML file and sample code for your reference.

 

Hope this helps.:)

test.xml

Test_Code.zip

post-24802-0-38018700-1328697110_thumb.jpg

Share this post


Link to post
Share on other sites

Hi Thanks for test code. But I think I am still having the issue.

 

Issue:

 

 

Parser Error

Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately. 

Parser Error Message: Could not load type 'FCExporter'.

Source Error: 


Line 1:  <%@ Page Language="C#" AutoEventWireup="true" CodeFile="FCExporter.aspx.cs" Inherits="FCExporter" %>

 

 

If I switch back to ASP.NET11 export handler, I will get the same error msg as the one in my first post.

 

Also I have deliberately create a test folder under my root website directory and put the following files inside.

 

FCExporter.aspx, FCExporter.aspx.cs, FusionCharts.js, FusionChartsExportComponent.js, testFC.asp (my test file) , Data.xml, Column3D.swf

 

 

BTW, how can I attach files here. I have got my version of test code ready.

Share this post


Link to post
Share on other sites

Hi Thanks for test code. But I think I am still having the issue.

 

Issue:

 

 

Parser Error

Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately. 

Parser Error Message: Could not load type 'FCExporter'.

Source Error: 


Line 1:  <%@ Page Language="C#" AutoEventWireup="true" CodeFile="FCExporter.aspx.cs" Inherits="FCExporter" %>

 

 

If I switch back to ASP.NET11 export handler, I will get the same error msg as the one in my first post.

 

Also I have deliberately create a test folder under my root website directory and put the following files inside.

 

FCExporter.aspx, FCExporter.aspx.cs, FusionCharts.js, FusionChartsExportComponent.js, testFC.asp (my test file) , Data.xml, Column3D.swf

 

 

test.zip

Share this post


Link to post
Share on other sites
Guest Sumedh

Hi. smile.gif

 

I am afraid, I could not replicate the same.

 

The above mentioned error might be related to your IIS server.

 

Please, try to set proper path for 'FCExporter.aspx' file in the XML file.

 

And also, please make necessary changes in the 'FCExporter.aspx.cs' file as below:

 

private const string SAVE_PATH = "./";

 

private const string HTTP_URI = "http://localhost:1549/"; - (directory for saving the exported image.)

 

 

Please find attached screenshot for your reference with this reply.

 

Hope this helps. smile.gif

post-24802-0-37687700-1329127407_thumb.jpg

Share this post


Link to post
Share on other sites

Hi. smile.gif

 

I am afraid, I could not replicate the same.

 

The above mentioned error might be related to your IIS server.

 

Please, try to set proper path for 'FCExporter.aspx' file in the XML file.

 

And also, please make necessary changes in the 'FCExporter.aspx.cs' file as below:

 

private const string SAVE_PATH = "./";

 

private const string HTTP_URI = "http://localhost:1549/"; - (directory for saving the exported image.)

 

 

Please find attached screenshot for your reference with this reply.

 

Hope this helps. smile.gif

 

Thanks for all the replies. I finally managed to solve the problem by re-installing the .net framework. The exportChart() is definitely issue-free. I can export the images now. Thanks very much, guys.

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