fractalbit

Render Chart On Click Event?

Recommended Posts

Hello, i am using the php implementation and have set the render as javascipt. Problem is i have a page with 12 charts, 9 of them hidden in tabs. But when i can the php method renderChart, all 12 of them start rendering and the page becomes unresponsive for some time.

 

So, is it possible to make the other charts to render only when the relevant tab is clicked? I know how to cactch the onlcick event of the tabs in javascript but do not know what to do next. Any ideas/suggestions?

Share this post


Link to post
Share on other sites

Hi,

 

Since you want this do be done at client-side (when tab is clicked), it would be better to use only JavaScript code to render the chart.

 

For more on how to render a chart using only JavaScript, read:

 

http://docs.fusioncharts.com/charts/contents/FirstChart/FirstChart.html

 

However, even at this stage you can make the chart load data from a php file, using Data URL method - to be precise. As a modification of the above mentioned code, you just need to change the path of the XML from static Data.xml file to a dynamic PHP file. Your PHP file should be able to generate and response back only the XML/JSON data for the chart. You need to just pass the URL of the PHP data provider page to the chart and the chart will automatically load the data internally using AJAX.

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