Sign in to follow this  
jgcrossman2

Changing external XML in same chart

Recommended Posts

I am new to both Fusion Charts and JavaScript...

 

 

 

I saw an example of this feature in the documentation or on the website, so I know the solution exists but have since lost track of it.

 

 

 

I would like to use JavaScript to change the

 

 

 

myChart.setDataURL("Data1.xml");

 

 

 

to a list of different options (say Data2.xml, Data3.xml...and so on) which I would call up through some buttons linked into Javascript at the bottom of the chart.

 

 

 

I was able to get the example that "changes the URL once and then turns off the button" to work well.

 

 

 

Now I would like to get crazy and have five or six different URLs available for the same chart. And I would like the buttons to stay alive.

 

 

 

If there is an example of this, please feel free to point me in that direction.

 

 

 

Much appreciation in advance,

 

 

 

John

Share this post


Link to post
Share on other sites
Guest Rajroop

Hello John,

 

 

 

Welcome to the FusionCharts Forum. :P

 

 

 

Yes, this is possible in FusionCharts.

 

 

 

An examples of this would be:

 

 

 

http://www.fusioncharts.com/Demos/JS/Index.html

 

 

 

For any further details concerning this, could you please visit our online documentation and click on the FusionCharts and JavaScript section on the left hand menu panel.

 

 

 

I hope this helps. :)

Share this post


Link to post
Share on other sites

Yes, that is the example I am looking at.

 

 

 

The trouble I am having is using external XML files rather than coding all the XML data into the JavaScript arrays on the one sheet.

 

 

 

Using that example, what would the proper syntax be for the array if the data were contained in separate files?

 

 

 

The reason I would like to use XML files is because the data is already being used in different charts elsewhere in the website and I only want to update the numbers once.

 

 

 

Thanks,

 

 

 

John

Share this post


Link to post
Share on other sites
Guest Rajroop

Hey John,

 

 

 

Could you please try the following method and let me know whether they suit your needs?

 

 

 

>>From each of the buttons invoke a function that executes the setDataURL method of the charts.

 

The code should be similar to that below:

 

 

 

chartObj.setDataURL("<Your choice of dataXML File>");

 

 

 

Could you please refer to the link below:

 

http://www.fusioncharts.com/docs/Contents/JS_setDataURL.html

 

 

 

I hope this helps. :)

Share this post


Link to post
Share on other sites

Rajroop,

 

 

 

Thanks for that. It works with two charts. I probably need to play around with it to make it work with more buttons.

 

 

 

As I said above, I am a newbie when it comes to JavaScript.

 

 

 

Thanks & Regards,

 

 

 

John

Share this post


Link to post
Share on other sites
Guest Rajroop

Hey John,

 

 

 

Happy to know that I could be of help. :(

 

 

 

Merry FusionCharting. :P May all the luck be with you. :)

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