Sign in to follow this  
jimalexander123

How to Dynamically resize the height of a chart

Recommended Posts

Hi,

In my web application, the user will click a button to display a new chart. Depending on one of the options they choose just BEFORE they click the button, I want to change the size of the resulting chart.

I'm using standard coding similiar to below, its the "400" I want to change dynamically.

Is this possible ?  The chart height would seem to be set and web page load time ?

Thanks

Jim.

   <div id="chart1div">
  FusionCharts
  </div>
  <script language="JavaScript"> 
  var chart1 = new FusionCharts("../../FusionCharts/MSColumn3D.swf", "chart1Id", "600", "400", "0", "1"); 
  chart1.setDataXML("<chart></chart>");
  chart1.render("chart1div");
  </script>

Share this post


Link to post
Share on other sites
Guest Basundhara Ghosal

Hi,

Welcome to FusionCharts forum. :P

Could you please try it by re-rendering the chart on the event of choosing "one of the options" (as you have mentioned)?

Please note, in that case you need to call the following parts of your code once again with the respective changes in order to resize the chart dynamically. 

var chart1 = new FusionCharts("../../FusionCharts/MSColumn3D.swf", "chart1Id", "600", "400", "0", "1"); 

  chart1.setDataXML("<chart></chart>");

  chart1.render("chart1div");

Hope this helps.

 

Share this post


Link to post
Share on other sites

Thanks for the pointer. This has worked.

For readers reference. On button click, I make a ajax request, via php script, using jquery. This has to be synchronous.

The php script calculates the required height of the graph, passes the value back, and this new value is used in the re-rendered chart object.

Thanks again.

Jim.

Share this post


Link to post
Share on other sites
Guest Basundhara Ghosal

Hi Jim,

You are welcome.

Thanks for sharing your ideas.

Happy FusionCharting. :P

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