Sign in to follow this  
Guest Rajroop

Trying to update chart type dynamically with javascript

Recommended Posts

Hi There,

Apologies if this has already been answered elsewhere on the forum, but I am having trouble trying to update a chart type dynamically via javascript.

I have a chart thats rendered on screen and then a set of radio buttons that contain the various chart types e.g. Bar Chart 3D, Pie Chart 3D, Multi Series Bar Chart etc.. So when I click on the radio button it changes the chart type and refreshes the chart. Here is my javascript method:

function changeChartType(type) 
{
 var chartObj = getChartFromId('querybar1');
 //alert(type);
 chartObj.FCChartType=type;
 chartObj.FCRender();
 FC_Rendered('querybar1');
}

Everytime I try this i get a 'Object doesn't support this property ot method' error. If i get rid of the FCRender line it I get no errors but the chart doesnt change.

The type variable I'm passing in is the path and file to the swf object, e.g 'FusionCharts/Pie3D.swf'

Any ideas on how to solve this issue? Any help appreciated.

Thanks,

Ahmed.

Share this post


Link to post
Share on other sites
Guest Rajroop

Hi,

To change a chart type in JavaScript you would need to re-render the chart from scratch.

  var myChart = new FusionCharts(SWFEquvalentOFyourChartType, yourChartId, width, height, "0", "0");

myChart.setDataURL(XMLURL);

 

myChart.render(YourChartContainerDIV);

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