Sign in to follow this  
BrianHanley

Error Rendering Chart With Javascript

Recommended Posts

I am trying to test rendering a 2D Doughnut chart via JavaScript so I have the Flash player in Firefox disabled. When I try and load the chart, Firebug reports the following error:

 

 

#25081850 FusionCharts::RendererManager >> There was an error rendering the chart.

 

Can anyone help me understand the issue? The chart renders fine via Flash.

 

Thanks.

Share this post


Link to post
Share on other sites

I should note that everything renders fine in Flash. This issue is only moving from Flash to JavaScript.

 

Here is the code:

 

<script src="fusion/charts/FusionCharts.js" type="text/javascript"></script>


<div id="chartContainer">FusionCharts will load here</div>
<script type="text/javascript"><!-- 		
   var sDataXML = "<chart  isSliced='0' streamlinedData='0' showPercentValues='1' isHollow='0' showLabelsAtCenter='0' chartBottomMargin='20'>" + "<set label='Retirement' value='50'/><set label='Vacation Home' value='14'/><set label='College' value='10'/><set label='Boat' value='9'/><set label='Camper' value='2'/><set label='World Travel' value='10'/><set label='Wedding' value='5'/>" + "<styles><definition><style type='font' name='captionFont' size='15' color='000000' /><style type='font' name='subCaptionFont' color='555555' /><\/definition><application><apply toObject='CAPTION' styles='captionFont' /><apply toObject='SUBCAPTION' styles='subCaptionFont' /><\/application><\/styles><\/chart>";

     var myChart = new FusionCharts( "fusion/charts/Doughnut2D.swf", "myChartId", "400", "300", "0", "1" );
     myChart.setXMLData(sDataXML);
     myChart.render("chartContainer");

   // --> 	
   </script>
</div>

 

 

 

Can you post your code please?

Share this post


Link to post
Share on other sites

Bizarre. When I try your code, I get nothing (in normal mode, Flash turned on) in Firefox, IE & Crome!

 

Weird thing is, the code executes without errors - I even turned on debug mode. Looking in Firebug, it creates the following code snip:

 

<object style="visibility: visible;" id="myChartId" data="../../js/Doughnut2D.swf" class="FusionCharts" type="application/x-shockwave-flash" width="400" height="300" lang="EN">
<param value="noScale" name="scaleMode"/>
<param value="noScale" name="scale"/>
<param value="opaque" name="wMode"/>
<param value="always" name="allowScriptAccess"/>
<param value="best" name="quality"/>
<param value="lang=EN&debugMode=1&DOMId=myChartId&registerWithJS=1&chartWidth=400&chartHeight=300&InvalidXMLText=Invalid data.&dataXML=%3Cchart%20%20isSliced%3D'0'%20streamlinedData%3D'0'%20showPercentValues%3D'1'%20isHollow%3D'0'%20showLabelsAtCenter%3D'0'%20chartBottomMargin%3D'20'%3E%3Cset%20label%3D'Retirement'%20value%3D'50'%2F%3E%3Cset%20label%3D'Vacation%20Home'%20value%3D'14'%2F%3E%3Cset%20label%3D'College'%20value%3D'10'%2F%3E%3Cset%20label%3D'Boat'%20value%3D'9'%2F%3E%3Cset%20label%3D'Camper'%20value%3D'2'%2F%3E%3Cset%20label%3D'World%20Travel'%20value%3D'10'%2F%3E%3Cset%20label%3D'Wedding'%20value%3D'5'%2F%3E%3Cstyles%3E%3Cdefinition%3E%3Cstyle%20type%3D'font'%20name%3D'captionFont'%20size%3D'15'%20color%3D'000000'%20%2F%3E%3Cstyle%20type%3D'font'%20name%3D'subCaptionFont'%20color%3D'555555'%20%2F%3E%3C%2Fdefinition%3E%3Capplication%3E%3Capply%20toObject%3D'CAPTION'%20styles%3D'captionFont'%20%2F%3E%3Capply%20toObject%3D'SUBCAPTION'%20styles%3D'subCaptionFont'%20%2F%3E%3C%2Fapplication%3E%3C%2Fstyles%3E%3C%2Fchart%3E&dataURL=" name="flashvars"/>
</object>

 

So, I never got to testing the "no-Flash" problem. May I ask, what version of FC are you using?

Share this post


Link to post
Share on other sites

I am using version 3.2.

 

 

Bizarre. When I try your code, I get nothing (in normal mode, Flash turned on) in Firefox, IE & Crome!

 

Weird thing is, the code executes without errors - I even turned on debug mode. Looking in Firebug, it creates the following code snip:

 

<object style="visibility: visible;" id="myChartId" data="../../js/Doughnut2D.swf" class="FusionCharts" type="application/x-shockwave-flash" width="400" height="300" lang="EN">
<param value="noScale" name="scaleMode"/>
<param value="noScale" name="scale"/>
<param value="opaque" name="wMode"/>
<param value="always" name="allowScriptAccess"/>
<param value="best" name="quality"/>
<param value="lang=EN&debugMode=1&DOMId=myChartId&registerWithJS=1&chartWidth=400&chartHeight=300&InvalidXMLText=Invalid data.&dataXML=%3Cchart%20%20isSliced%3D'0'%20streamlinedData%3D'0'%20showPercentValues%3D'1'%20isHollow%3D'0'%20showLabelsAtCenter%3D'0'%20chartBottomMargin%3D'20'%3E%3Cset%20label%3D'Retirement'%20value%3D'50'%2F%3E%3Cset%20label%3D'Vacation%20Home'%20value%3D'14'%2F%3E%3Cset%20label%3D'College'%20value%3D'10'%2F%3E%3Cset%20label%3D'Boat'%20value%3D'9'%2F%3E%3Cset%20label%3D'Camper'%20value%3D'2'%2F%3E%3Cset%20label%3D'World%20Travel'%20value%3D'10'%2F%3E%3Cset%20label%3D'Wedding'%20value%3D'5'%2F%3E%3Cstyles%3E%3Cdefinition%3E%3Cstyle%20type%3D'font'%20name%3D'captionFont'%20size%3D'15'%20color%3D'000000'%20%2F%3E%3Cstyle%20type%3D'font'%20name%3D'subCaptionFont'%20color%3D'555555'%20%2F%3E%3C%2Fdefinition%3E%3Capplication%3E%3Capply%20toObject%3D'CAPTION'%20styles%3D'captionFont'%20%2F%3E%3Capply%20toObject%3D'SUBCAPTION'%20styles%3D'subCaptionFont'%20%2F%3E%3C%2Fapplication%3E%3C%2Fstyles%3E%3C%2Fchart%3E&dataURL=" name="flashvars"/>
</object>

 

So, I never got to testing the "no-Flash" problem. May I ask, what version of FC are you using?

Share this post


Link to post
Share on other sites

I deployed a page where you can replicate the error: http://www.mystikspiral.net/NewFusionCharts/FlashTest.html

 

Running in Firefox, the chart will render fine in Flash. Then disable the Flash player and you will get the error I referenced above.

 

--Brian

 

Bizarre. When I try your code, I get nothing (in normal mode, Flash turned on) in Firefox, IE & Crome!

 

Weird thing is, the code executes without errors - I even turned on debug mode. Looking in Firebug, it creates the following code snip:

 

<object style="visibility: visible;" id="myChartId" data="../../js/Doughnut2D.swf" class="FusionCharts" type="application/x-shockwave-flash" width="400" height="300" lang="EN">
<param value="noScale" name="scaleMode"/>
<param value="noScale" name="scale"/>
<param value="opaque" name="wMode"/>
<param value="always" name="allowScriptAccess"/>
<param value="best" name="quality"/>
<param value="lang=EN&debugMode=1&DOMId=myChartId&registerWithJS=1&chartWidth=400&chartHeight=300&InvalidXMLText=Invalid data.&dataXML=%3Cchart%20%20isSliced%3D'0'%20streamlinedData%3D'0'%20showPercentValues%3D'1'%20isHollow%3D'0'%20showLabelsAtCenter%3D'0'%20chartBottomMargin%3D'20'%3E%3Cset%20label%3D'Retirement'%20value%3D'50'%2F%3E%3Cset%20label%3D'Vacation%20Home'%20value%3D'14'%2F%3E%3Cset%20label%3D'College'%20value%3D'10'%2F%3E%3Cset%20label%3D'Boat'%20value%3D'9'%2F%3E%3Cset%20label%3D'Camper'%20value%3D'2'%2F%3E%3Cset%20label%3D'World%20Travel'%20value%3D'10'%2F%3E%3Cset%20label%3D'Wedding'%20value%3D'5'%2F%3E%3Cstyles%3E%3Cdefinition%3E%3Cstyle%20type%3D'font'%20name%3D'captionFont'%20size%3D'15'%20color%3D'000000'%20%2F%3E%3Cstyle%20type%3D'font'%20name%3D'subCaptionFont'%20color%3D'555555'%20%2F%3E%3C%2Fdefinition%3E%3Capplication%3E%3Capply%20toObject%3D'CAPTION'%20styles%3D'captionFont'%20%2F%3E%3Capply%20toObject%3D'SUBCAPTION'%20styles%3D'subCaptionFont'%20%2F%3E%3C%2Fapplication%3E%3C%2Fstyles%3E%3C%2Fchart%3E&dataURL=" name="flashvars"/>
</object>

 

So, I never got to testing the "no-Flash" problem. May I ask, what version of FC are you using?

Share this post


Link to post
Share on other sites

Yep, I'm with you now. My bad, I had path error in my link to the SWF file. Curious that it rendered the object anyway... but whatever.

 

I've got debug on now in my local version and I'm having another look at it.

Share this post


Link to post
Share on other sites

The problem is that FC doesn't seem to know that Flash isn't turned on. If it did, you could just change the renderer. Seems like a defect to me.

 

In my own application, we have a check for Flash and we force the renderer based on that check (with the option to override via a URL param). You may have to go outside FC to do that. I'm looking at the objects they expose and I'm not seeing an sort of "Flash awareness".

 

So my short-term solution to you is try a Flash sniffer, email support, and I'll keep digging (for you as well as my own curiosity).

 

 

Update:

I can find no way from within FC to get this to work. Seems that it thinks that Flash is enabled. I don't know if the client is reporting a Flash version number, or what it is. I've tried several different things. I'd say this was a bug, personally.

 

Now, if you just want to test render a Javascript chart, that part is easy. Just set:

 

FusionCharts.setCurrentRenderer("javascript");

 

before you call the renderer. I just do it before I instantiate the object.

Edited by DannyR

Share this post


Link to post
Share on other sites

You read my mind! http://www.mystikspiral.net/NewFusionCharts/FlashTest.html

 

I made the change as you were editing your post. It does render via JavaScript. My issue now is why the mechanics seem off? Is it by virtue of the fact that the Flash player is there but disabled?

 

 

The problem is that FC doesn't seem to know that Flash isn't turned on. If it did, you could just change the renderer. Seems like a defect to me.

 

In my own application, we have a check for Flash and we force the renderer based on that check (with the option to override via a URL param). You may have to go outside FC to do that. I'm looking at the objects they expose and I'm not seeing an sort of "Flash awareness".

 

So my short-term solution to you is try a Flash sniffer, email support, and I'll keep digging (for you as well as my own curiosity).

 

 

Update:

I can find no way from within FC to get this to work. Seems that it thinks that Flash is enabled. I don't know if the client is reporting a Flash version number, or what it is. I've tried several different things. I'd say this was a bug, personally.

 

Now, if you just want to test render a Javascript chart, that part is easy. Just set:

 

FusionCharts.setCurrentRenderer("javascript");

 

before you call the renderer. I just do it before I instantiate the object.

Share this post


Link to post
Share on other sites

I can confirm this is an error with the desktop browser. When the Flash plug-in is enabled, the chart renders fine. If I disable the plug-in, I get the renderer error. Hitting the same page from my iPhone has no problem at all (chart renders via JavaScript).

 

Sounds like this is a bug? It is pretty reasonable to assume some people could have this plug-in disabled for any number of reasons.

 

 

You read my mind! http://www.mystikspi.../FlashTest.html

 

I made the change as you were editing your post. It does render via JavaScript. My issue now is why the mechanics seem off? Is it by virtue of the fact that the Flash player is there but disabled?

 

 

 

Share this post


Link to post
Share on other sites

I would file it as a bug. The scenario you present is reasonable. We know that (at least in Firefox) if Flash is present but disabled, the chart throws a Javascript error. Unless you and I can respond to this error to have the application take a different action, then that IS a bug.

Share this post


Link to post
Share on other sites

Btw, in case you're interested, we're a Dojo shop (not a big fan, but it gets the job done). So here's my test for Flash - works 100%:

 

useFlash = !!dojox.embed.Flash.available;

 

I'm sure there are plenty of free sniffers around that will do the same thing. My point is, its definitely possible to detect this scenario and respond properly to it. More evidence that this is a bug or AT THE VERY LEAST an enhancement request.

Share this post


Link to post
Share on other sites

I've been trying to test a website internally using the iPhone Simulator (version 3.1) before putting it live and have been having the same problem / error message. Although iPhones can't run flash, it appears to be believing there is flash installed and so get the JavaScript error above in the debug console. The Fusion Charts online examples don't work (so its not just my implementation!).

Since the examples do work in a real iPhone (and so the simulator isn't an exact copy of the iPhone (!) ), I'm sure this is partly a bug in the simulator, but since other websites work correctly in the simulator, I'd say this is a bug in Fusion charts also. Its a real pain for me because i've no way of testing the system before go live now (no WiFi hotspots due to security concerns)...

Edited by Peter Tweed

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