Are there any Gantt chart examples that use MySQL?

« 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 Rob on 1st January 2016

I like the RGRAPH library, but experimenting with the GANNT.
Are ther examples to use a mysql database ?
I would like to generate a per line overview with activities with different colours.

             var data = [
                         // First row

                          [5, 2, null, 'Day 1', 'green'],
                          [7, 1, null, 'Day 1', 'purple'],
                          [8, 2, null, 'Day 1', 'green'],
                          [10, .25, null, 'Day 1', 'yellow'],
                          [11, .5, null, 'Day 1', 'purple'],
                          [16, .5, null, 'Day 1', 'green']
Posted by Richard on 3rd June 2014
The only example of MySQL is in the implementation guide:

Keep in mind that you PHP runs first, on your server, and then whatever the output is is sent to the browser - where JavaScript runs. So you could do something like this:

     $str = array();
     foreach($data as $row) {
               $str[] = sprintf('[%d, %d, null, '%s', '%s']',$row['start'],$row['duration'],$row['complete'],$row['label']);

     $str = implode('.', $str);
  var data = [
              // Rows
              <?php echo $str ?>

Something like that. I haven't tested it so there might be a small error or two but that show the principle.


Add a reply

« Back to message list