gonzavillar

Printing/Exporting chart not working in IE11

Recommended Posts

Hello, I have a website that's been using FusionCharts for a while without any issues.

But now I just realized that with IE11, the export functions I have built are no longer working.

 

The printing and exporting works fine in all other version of IE, Firefox and Chrome, and even on IE11 when compatibility view is turned ON.

 

I'm building the chart server-side like this:

Dim chartHtml = FusionCharts.RenderChartHTML("Charts/FusionCharts/ScrollColumn2D.swf?registerWithJS=1", "", xml.ToString(), "MyChart", "100%", "350", False, True, True)

I've noticed that when on IE10 or IE11 compatibility view, this renders an <object> element, but on IE11 it creates an <embed> element.

 

 

And then the javascript functions I've been using are these:

function printChart() {          

            var chartToPrint = document.getElementById('MyChart');
            chartToPrint.print();
        }
        function ExportMyChartPDF() {

            var chartObject = document.getElementById('MyChart');

            if (chartObject.hasRendered()) chartObject.exportChart({ exportFormat: 'PDF' });

        }
        function ExportMyChartJPG() {

            var chartObject = document.getElementById('MyChart');

            if (chartObject.hasRendered()) chartObject.exportChart({ exportFormat: 'JPG' });

        }

These functions throws errors saying the object does not support the "print" method, or the "hasRendered".

"Object doesn't support this property or method"

 

Do you know why is this happenning and if there's a way to fix it?

 

Thanks.

 

 

 

 

Share this post


Link to post
Share on other sites
Guest Sashibhusan

Hi,

 

It seems you are implementing some older method of rendering and exporting of charts and printing them.

 

Also, you are rendering Flash charts in your application.

 

If feasible, we will suggest you to exclusively render all the charts in JavaScript mode.

 

Please make the necessary changes as mentioned below:

 

a. Upgrade the FusionCharts Suite XT version to latest available version

 

b. Replace "RenderChartHTML()" with "RenderChart()" method

Dim chartHtml = FusionCharts.RenderChartHTML("Charts/FusionCharts/ScrollColumn2D.swf?registerWithJS=1", "", xml.ToString(), "MyChart", "100%", "350", False, True, True)

c. Get the chart object reference using "FusionCharts()" method instead of "getElementById()" in JavaScript code

var chartObject = FusionCharts("myChartId");

Now, for exporting the charts, no need to set any export related attributes in chart XML/JSON data. Just only setting "exportEnabled" to "1" will automatically call to external server for processing and get the image/PDF of the chart available to the client's machine.

 

Also, please note that JavaScript charts won't cause any issue while printing from different browsers.

 

For more information on "Exporting Pure JavaScript charts", please visit the link: http://docs.fusioncharts.com/charts/contents/exporting-image/ECPureJS.html

 

Hope this helps!

Share this post


Link to post
Share on other sites

Hi, thanks for your response.

 

I was able to create the chart using your approach and they print and export fine.

However, a couple of issues came up:

 

1 - All the white spaces in my data are being filled by plus signs (+)

2 - This approach doesn't work when using update panels

 

Any suggestion on how to address those issues?

 

Thanks!

Share this post


Link to post
Share on other sites
Guest Sashibhusan

Hi,

 

Glad that the suggestion was helpful.

1 - All the white spaces in my data are being filled by plus signs (+)

>>Could you please provide the XML/JSON data feed to the chart for plotting, so that we can better look into your issue?

 

2 - This approach doesn't work when using update panels

>>You would need to use once extra script "updatepanelhook.fusioncharts.js" to update the chart data in ASP.NET AJAX Update Panel. For more information on this, please visit the link: http://docs.fusioncharts.com/charts/contents/guide-for-web-developers/vbnet/VB_UpdatePanel.html

 

Hope this helps!

Share this post


Link to post
Share on other sites
Guest Sashibhusan

Hi Gonzalo,

 

Glad to know, you have managed of your own to resolve the issues. :)

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