spectrum

Ajax refresh does not work with chartWidth of 100%

Recommended Posts

Hi,

I have a project where I am refreshing a div with a chart via xmlhttprequest, and I am running some Javascript from the response - when I try to set a chartWidth of 100% within the ajax-provided response the chart is not displayed at all.  If I use a chartWidth that is a pixel value then it does work.  Can anyone explain what is going on, and how I can get FusionCharts to support a width of 100% when operating using this technique.

Sorry that I have not shown any code in the actual post - I have attached some simple html and xml files that demonstrate the behaviour.

Thanks very much.

FusionChartsTest.zip

Share this post


Link to post
Share on other sites
Guest Madhumita

Hello,

There were some issues with double quotes and single quotes while using parameters to instantiate a new chart. I have modified the necessary parts in your code. I am attaching them for your reference.

 

Hope this helps. Looking forward to your reply. :D

FusionChartsTest.zip

Share this post


Link to post
Share on other sites

Hi Madhumita,

When I try your version I get the same problem - the second chart does not display at all.  I am using IE 7.0.6001.18000.  Does it work for you?

Share this post


Link to post
Share on other sites
Guest Madhumita

Hello,

in your code could you please replace myChart2.render("ajaxdiv"); 

with

document.getElementById("chartdiv").innerHTML = myChart2.getSWFHTML(); ?

Hope this helps. :D

Share this post


Link to post
Share on other sites

Hi Madhumita,

Yes that works, and it also works with :

document.getElementById("ajaxdiv").innerHTML = myChart2.getSWFHTML();

I need it to work with the "ajaxdiv" reference because the xmlhttpresponse will send html with variable div containers into which I will need to render the charts, and I won't know the names of the container divs until the xmlhttpresponse is received. i.e. ajaxdiv might not be called ajaxdiv, but will be named according to dynamic rules.

Do you suggest I change my production code as above, or are you still investigating?

 

Share this post


Link to post
Share on other sites
Guest Madhumita

Hello,

You can use any division name to render the chart, as you wish to.

As of now, please implement with this code while using AJAX Call.

In our next FusionCharts.js, we will try to overcome this issue.

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