How do I update my Bar chart via an AJAX request?

« Back to message list

Enter your email address to get email updates on this topic. You can stop receiving updates by clicking the link in the update email messages.

Posted by Klaus Hillebrand on 1st November 2012

i try to update an bar graph with stacked bars.
>> print "var new_data = this.responseText;"; <<
>> alert (new_data); <<
shows [[4,5],[5,7],[6,5],[5,14],[1,6],[2,7],... which looks good for me.

But when I try to build the new graph, >> new RGraph.Bar('bar1',new_data) << nothing happens. The graph is drawn empty.
I think it's something about this string, numbers but i don't get it.
Trying for two days now.
Please help

Posted by RGraph support on 2nd November 2012

The responseText is a string when it's returned so you need to eval it and convert the data into an array. With the data that you have you can use the eval() function - like this:

eval('var new_data = ' + this.responseText);
Posted by Klaus Hillebrand on 2nd November 2012
So simple, but so far away from me...
Still have to learn a lot...
Thank you so much, kept me from going crazy...

Add a reply

« Back to message list