Sign in to follow this  
Scipio

Fusioncharts Compatibility With Prototype

Recommended Posts

HI,

I have recently been upgrading to FusionCharts 3.2.1 and I am encountering problems with compatibility with our existing use of Prototype. Because Highcharts uses jquery it seems like the $ function is being overridden. I know that jquery contains the ability to set a noConflict mode and it seems like Fusioncharts.js is making of use of that (from what I can tell of the debug js file), but perhaps highcharts is not. Is there a way to force Fusioncharts/Highcharts to be compatible with Prototype that does not involve making direct changes to the functions and function calls contained within the provided javascript files?

 

Thanks,

 

- Scipio

Share this post


Link to post
Share on other sites

Hi Scipio,

Thank you for your post.

How are you adding jQuery and prototype in page?

Make sure prototype is added before FusionCharts.js and FusionCharts will dynamical add Highcharts.js and jQuery.js from the Chart folder if necessary.

If your page required jQuery too then add that script also before FusionCharts.js.

also make sure that you are using the latest JS files that is released with the PowerCharts pack.

Share this post


Link to post
Share on other sites

Hi Scipio,

Thank you for your post.

How are you adding jQuery and prototype in page?

Make sure prototype is added before FusionCharts.js and FusionCharts will dynamical add Highcharts.js and jQuery.js from the Chart folder if necessary.

If your page required jQuery too then add that script also before FusionCharts.js.

also make sure that you are using the latest JS files that is released with the PowerCharts pack.

 

Thank you for the response. I am adding the prototype.js first, and Fusioncharts.js after. I am not adding jquery or highcharts to the page myself, I let Fusioncharts do so. I am using the latest files (Fusioncharts.js, highcharts.js, and jquery.min.js) from the Powercharts paid version. I have also tried the files form the Fusioncharts paid version, with the same result. Jquery is still overriding the $ function that prototype requires to function. I know this because I receive some javascript errors and odd behavior on my page, and the use of firebug shows me that jquery is acting on some of the variables in prototype.js when prototype calls $ with them. This problem only shows up when using the javascript/HTML rendering of charts.

 

Thanks,

 

Scipio

Share this post


Link to post
Share on other sites

Hi Scipio,

Thanks for you reply.

Could you please try few things to point out the issue.

1. create a simple HTML sample of your page with prototype.js and FusionCharts .js included.

Then try to render a JavaScript chart in you page which will load the jQuery.js and Highcharts,js in your page.

Then after rendering the chart track the "$" in firebug whether it point to jQuery or not.

If "$" still point to jQuery then post us the sample in zipped form to printout the issue.

OR.

2. Add jQuery.js after prototype.js and then add another script tag of "jQuery.noConflict();" then add FusionCharts.js in your page.

In that case FusionCharts will not add jQuery as it is already exist.

Share this post


Link to post
Share on other sites

I proceeded to try the second thing you mentioned, adding jQuery myself and using another script block to set jQuery into noConflict mode, and that worked great. I no longer revive JavaScript errors or strange behavior. I am grateful for the assistance and to jQuery for providing this functionality.

 

Thanks,

 

-Scipio

Share this post


Link to post
Share on other sites
Guest Angie

Hi,

 

Thank you very much for your appreciation,

 

We are glad to know that you problem has been resolved.

 

Happy FusionCharting!biggrin.gif

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