Can I have an AJAX/PHP/MySQL trend line?

« 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 JPL on 1st January 2016
Hello all.

I would like to have an dfynamic refresh on my graph (trend line) like Demos/line07.html from the pack. or

But I'd like to get the data from my SQL database.

I made a first part in php that calls the data to place them into an array $data.
I have the DrawGraph completed like I can find from this site.

         d1 = <?php print($data_string) ?>;
         if (d1.length > 250) {
             d1 = RGraph.array_shift(d1);

         if (document.all && RGraph.isIE8()) {
             alert('[MSIE] Sorry, Internet Explorer 8 is not fast enough to support animated charts');
         } else {
             window.__rgraph_line__.original_data[0] = d1;
             setTimeout(drawGraph, 100);

The Php $data_string is called only once. How can I refresh this?

Many thanks
Posted by RGraph support on 14th February 2013

You would need to use AJAX to get new data and then updated your d1 array. Then do a redraw. More on AJAX here:

There's also a HOWTO guide for updating your chart here:

RGraph Support

Add a reply

« Back to message list