Sign in to follow this  
idefaye

js files dependency and not asynchronous web safe

Recommended Posts

Hello.

 

We want to use fusionChartXT javascript inside widgets that could be hosted by different web servers. We have the widget site on http://widgetbase/ and they can be used a client host like: http://host/When the widget is loaded on the host it takes care of loading all js dependecies it needs, including fusionCharts.js file.

 

Fusion chart is not able to load itself properly and cleanly, we have two issues:

 

Issue1:

To load dynamically fusionchart we use : jQuery.getScript().

When loading only fusionCharts.js from our http://widgetbase/externals/fusioncharts/ it seems that fusionCharts tries to load automatically FusionCharts.HC.js and FusionCharts.HC.Charts.js from http://host/ where they do not exists.

It does not look at the good place ! Even if we have the widget on the same domain, it still doesn't look at the right place! We understand that guessing from where a js files was loaded is hasardous, but we haven't found a configuration option to tell it where look at.

 

Issue2:

If we add those two files to our dynamic loading, still using jQuery.getScript(). Since web is asynchronous, a file may be loaded before another. But FusionChart seems to ignores this concept and crashes if a files is loaded before another, which happens almost all the time, since the smaller files load faster than the big ones.

If there is a loading order dependency it should be dealt with within the same file code and not by file loading order. Or a better option is to have everything inside a single file, this would made pageloading faster, rather than loading 3 files.

For now, to prevent errors, we had to make an ugly synchronous loading, which blocks and slows page loading.

 

Please make FusionChart fully asynchronous compatible and/or have all the library in one simple loading file.

 

Share this post


Link to post
Share on other sites
Guest Sashibhusan

Hi,

 

Welcome to FusionCharts Forum.

 

>>Please let me clarify myself once that to load the FusionCharts JavaScript framework, at the very first point you would need to load the "FusionCharts.js" file, whose "relative URL" (and not absolute path) needs to be provided to "jQuery.getScript()".

 

>>Also, please make sure all the other dependency JavaScript files need to be copied in the same directory where "FusionCharts.js" file present. Because, FusionCharts.js is smart enough to automatically load the other required JavaScript files - jquery.min.js, FusionCharts.HC.Charts.js and FusionCharts.HC.js on-demand.

 

Now coming to your issue, as you are willing to load charts on client host (whereas actual charts are in widget site) and as you have mentioned "When the widget is loaded on the host it takes care of loading all js dependecies it needs, including fusionCharts.js file.". So, could you please confirm once, if all other FusionCharts JavaScript files loading correctly in this case?

 

As you have mentioned, the "FusionCharts.js" file is looking for other files in http://host/ , it means the FusionCharts.js loaded from http://host/ and not from http://widgetbase/ex...s/fusioncharts/ if I am not wrong.

 

So, please try modifying your code accordingly and see if the suggestion helps.

 

Awaiting your valuable response.

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