bmcwhorter

Resizeto(Width, Height) Throwing Javascript Runtime Error While Using Flash Charts

Recommended Posts

Hi,

 

I try to run the following and it works great in javascript.  However when I run this on the flash variant, I get the error below

 

FusionCharts(ChartID).resizeTo(currWidth, currHeight);

 

The error being thrown is 0x80004005 - JavaScript runtime error: unknown exception 

when using flash:

 

It's getting thrown in this block of code:

 

function __flash__addCallback(instance, name) {
  instance[name] = function () { 
    return eval(instance.CallFunction("<invoke name=\""+name+"\" returntype=\"javascript\">" + __flash__argumentsToXML(arguments,0) + "</invoke>"));
  }
}
 
the name parameter is "resize"
 
the instance parameter is the correct object with the following outer html :
 
<OBJECT width=698 height=612 class=FusionCharts id=Chart1 classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000 lang=EN style="VISIBILITY: hidden"><PARAM NAME="_cx" VALUE="18468"><PARAM NAME="_cy" VALUE="16193"><PARAM NAME="FlashVars" VALUE="lang=EN&debugMode=0&scaleMode=noScale&animation=undefined&DOMId=Chart1&registerWithJS=1&chartWidth=500&chartHeight=500&InvalidXMLText=Invalid data.&stallLoad=true&dataXML=undefined&dataURL=rdDownload/m1dbkmsfnxkdecpw0r15w31l-d429cd2e50b94dbba3ad385d5b18d337.xml"><PARAM NAME="Movie" VALUE="rdTemplate/rdAnimatedChart/Area2D.swf"><PARAM NAME="Src" VALUE="rdTemplate/rdAnimatedChart/Area2D.swf"><PARAM NAME="WMode" VALUE="Opaque"><PARAM NAME="Play" VALUE="0"><PARAM NAME="Loop" VALUE="-1"><PARAM NAME="Quality" VALUE="High"><PARAM NAME="SAlign" VALUE="LT"><PARAM NAME="Menu" VALUE="-1"><PARAM NAME="Base" VALUE=""><PARAM NAME="AllowScriptAccess" VALUE="always"><PARAM NAME="Scale" VALUE="NoScale"><PARAM NAME="DeviceFont" VALUE="0"><PARAM NAME="EmbedMovie" VALUE="0"><PARAM NAME="BGColor" VALUE="FFFFFF"><PARAM NAME="SWRemote" VALUE=""><PARAM NAME="MovieData" VALUE=""><PARAM NAME="SeamlessTabbing" VALUE="1"><PARAM NAME="Profile" VALUE="0"><PARAM NAME="ProfileAddress" VALUE=""><PARAM NAME="ProfilePort" VALUE="0"><PARAM NAME="AllowNetworking" VALUE="all"><PARAM NAME="AllowFullScreen" VALUE="false"><PARAM NAME="AllowFullScreenInteractive" VALUE=""><PARAM NAME="IsDependent" VALUE="0"></OBJECT>
 

Share this post


Link to post
Share on other sites

What version of FusionCharts are you using? Also, any specific browser and are you running it directly off file:// or on a server?

 

To me it looks like a Global Security Settings issue of Flash.

Check out http://docs.fusioncharts.com/charts/Tools/FlashPlayerSecuritySetup/HowToSetup.html

http://forum.fusioncharts.com/topic/10016-flash-player-103-global-security-settings/

Share this post


Link to post
Share on other sites

Using the latest version of Fusion charts and I'm running this in the browser.  Seems to work ok for flash in Chrome and Firefox, but IE 7,8,9,10 all throw the error.  The error is never thrown when the chart is rendered with javascript, only flash.

Share this post


Link to post
Share on other sites
To me it looks like a Global Security Settings issue of Flash.
 
 
Change the settings to allow the URL/local folder that is hosting the SWF and let me know? Am up and waiting. :)
 
EDIT:
Moved your topic to the JS section and um... since now I know it's urgent, modified the topic title.

Share this post


Link to post
Share on other sites

Thanks for the quick reply.  Unfortunately that didn't solve anything.  I wouldn't mind rendering the chart again if it means I don't have to load the data again and slow down performance.

 

When I run the following, I get this error:

 

   var chartReference = FusionCharts(sAnimatedChartID);
   chartReference.width = currWidth;
   chartReference.height = currHeight;
   chartReference.render();

 

DesignTimeError: #25081843 Chart1.render Error >> #25081843:IECompatibility() Chart Id is same as a JavaScript variable name. Variable naming error. Please use unique name for chart JS variable, chart-id and container id.

 
...y() Chart Id is same as a JavaScript variable name. Variable naming error. Pleas...

 

 

I dont care if I go about this by using the resizeTo method or the render method, but I want to be able to change the size of the chart in both flash and javascript without getting any errors and without having to destroy the chart and recreate it, which is the only thing that has worked so far.

Share this post


Link to post
Share on other sites

Edit: If I add the containing div to the render method as a parameter I don't seem to get the error when rendering the chart again.  However, the render is much slower than the resize and I would like to be able to use resizeTo

Share this post


Link to post
Share on other sites
Guest Sumedh

Hi bmcwhorter,

 

Can you please check if the JavaScript variable name and the chart id are same?

 

You have to provide unique names for JavaScript variables and chart ids while creating the chart.

Share this post


Link to post
Share on other sites

Yes, I know how to render the chart appropriately.  If you read what I wrote, you will see that I can make it render if needed.  However, I don't want to have to force the data to be re-loaded everytime the chart changes size.  That's why I need to use the resizeTo method, but you guys have an error with Internet Explorer and the flash version of the chart when using the resizeTo method.  I really need to get that fixed. 

 

It is ABSOLUTELY not the case that you should have to destroy the chart and then recreate it just because it changes size, that is the most inefficient scenario possible.  Please advise or provide a work around.

Share this post


Link to post
Share on other sites

Hey bmcwhorter,

 

Since you are re rendering the chart with the same id and container, IE raises the "#25081843:IECompatibility() Chart Id..." error. If you would like to resize the chart, please try using the below code.

 

Ref. Code:

  var chartReference = FusionCharts(sAnimatedChartID);

   chartReference.width = currWidth;
   chartReference.height = currHeight;
   chartReference.resizeTo(currWidth, currHeight);
 

Similar demo link:  http://docs.fusioncharts.com/charts/Code/JavaScript/Basics/ChangingChartProperties/Resize_chart_using_pixel_values.html

Share this post


Link to post
Share on other sites

Hi, 

 

Did you read my previous posts?  I have already done this.  In fact, if you actually tried the sample I gave you would see that it produces an error in Internet Explorer.  That's the whole reason of this post is to tell you that resizeTo IS NOT WORKING.  So, do you have a solution to the bug?

Share this post


Link to post
Share on other sites
Guest Sashibhusan

Hi,

 

As per your requirement, we have tested the "resizeTo()" method and it is working fine from our end using latest version of FusionCharts XT V3.3.1 SR2.

 

Please find the attached screen shot of the chart re sized in IE10 browser, without any error.

 

Could you please check once the similar sample demo from the link: http://docs.fusioncharts.com/charts/Code/JavaScript/Basics/ChangingChartProperties/Resize_chart_using_pixel_values.html , at your and and let us know if the issue is replicated?

 

Also, please provide a bit more information (mentioned below) with scaled down sample or any live URL (if feasible), to help us to replicate the sample?

 

a. The screen shot of the error details

 

b. FusionCharts version details.

 

Awaiting your valuable response.

post-23588-0-45291500-1371454757_thumb.png

Share this post


Link to post
Share on other sites

Hi,

 

This is the version that we are working with:

 

3.3.1-release.19520

 

Is there a newer release that may fix this issue?

 

Also, the error I got was this:

 

The error being thrown is 0x80004005 - JavaScript runtime error: unknown exception 

when using flash:

 

It's getting thrown in this block of code:

 

function __flash__addCallback(instance, name) {
  instance[name] = function () { 
    return eval(instance.CallFunction("<invoke name=\""+name+"\" returntype=\"javascript\">" + __flash__argumentsToXML(arguments,0) + "</invoke>"));
  }
}
 
It almost looked like it was trying to add duplicate callback functions.  Do you think it has anything to do with the fact that I am using the FC_Rendered global function?

Share this post


Link to post
Share on other sites
bmcwhorter,

 

We ran into this same problem. What I found was that this would happen if the chart was rendered off-screen first (like in a hidden <div>). So, we made sure that we only create/render the chart client-side once the container <div> was visible. After which, any calls to resizeTo() seem to work fine.

 

Regards,

 

Mike Oliver

Share this post


Link to post
Share on other sites

Hey Mike,

 

We are actually inserting the div into the page with an ajax request, so I think this may be our problem.  I'm going to have to change some things to be able to test and see if inserting the div on page load and just sending the chart back afterwords fixes it.  I'll let you know, but thank you so much for the tip.

 

-Ben

Share this post


Link to post
Share on other sites

In case anyone else runs into this problem, if you manipulate the container of the chart at all after its rendered it can cause this problem.  We had a resizer on our chart to allow dynamic drag resizing ... we had to move the initialization of that to before render of the chart, it fixed the problem.

Share this post


Link to post
Share on other sites

Hi,

 

As suggested by bmcwhorter, please check if you are manipulating the chart container after the chart has been rendered. If yes, then please do the manipulation before render of the chart.

 

Awaiting your feedback.

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