muxxa

Error In Ie "chart Id Is Same As A Javascript Variable Name In Window Scope"

Recommended Posts

I'm getting the following error while embedding a chart:

"Chart Id is same as a JavaScript variable name in window scope"

 

I've found an explanation on this topic here: http://www.fusioncharts.com/forum/Topic30589-27-2.aspx :

 

> 1. You have any global JS variable with the same name as the chart's id

> 2. If you have the same name for the charts JSObject variable and chart's ID.

> Shamasis Bhattacharya

 

But that's not what's wrong with my code.

 

In my case (IE8), if I examine the variable window[this.id] (FusionCharts.debug.js L1257), it points to a <div> element with that ID.

So in Internet Explorer, it appears that `window['some_id']` incorrectly does document.getElementByID('some_id')

I don't think this is the intention of the check being carried out in the FusionCharts code.

maybe the check should be:

if(window[this.id]!==undefined && window[this.id].tagName===undefined)

 

or some such?

 

Cheers,

 

Eoghan

 

P.s. This was just the first of a few problems I had when attempting to use an embedded chart with the 3.2 version.

I've since downgraded the JavaScript version, while maintaining the 3.2 versions of the flash files.

Share this post


Link to post
Share on other sites

Greetings,

 

Thanks for looking into the issue you are presently facing.

 

Considering that your page throws the following 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.

 

Let me explain the scenario as to why this check has been done in the first place.

 

In Internet Explorer, when you have any variable (including HTMLNodes, form elements, etc) in the window scope that has the same name as a chart's id, the Flash External Interface routines for those charts are occasionally observed to be broken. This causes various JS functions to stop functioning as expected. This issue is a slightly difficult one to detect for users who are deploying FusionCharts by keeping non-IE browsers as reference.

 

Now, the check (that you have mentioned) has been done at the beginning of the render() function (i.e. even before the object-embed code of the chart has been appended to the DOM). Thus, if you are doing a .render() on a chart, be it IE or any other browser, you must have window['chart-id'] as undefined. In case that is not happening for you, give us a live link to your problem or a scaled-down sample that exhibits the error you mention and we will surely look into it on a priority basis.

 

Furthermore, if you are re-rendering a chart with the same id and in the same container, FusionCharts JS 3.2.1 will raise this error on IE. If you dispose() your old chart and then create a new instance, this issue will likely be resolved.

 

We will definitely incorporate the probable fix that you have mentioned, in the event we are unable to fix your issue.

 

Also, on a separate note, we are very sorry that you have encountered a large number of issues with the new JS. Our sole aim for the new JS was to make FusionCharts even better by adding more features, error handling and fixes to most browser-specific issues. I would request you to send us your feedback with all the issues that you are encountering and we promise to resolve them. That would not only benefit you but would also benefit the whole FusionCharts community.

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