Jump to content

Timeline/Gantt Chart using PHP + MySQL?


sleepyw

Recommended Posts

Using just PHP and MySQL (and maybe some canned js), is code available to create a graphical chart that can plot the timeline of items given a start date and end date?

 

For example, let's say I have 20 projects and want to visually see how long they are taking to complete. In the MySQL db, I have a field for start date and end date (and project title). Is there something out there that can grab that data (filtered by whatever criteria) that can output the results in a chart form, something like a Gantt chart/horizontal timeline, similar to this (without all the text on the left side):

 

53264.gif

 

Link to comment
https://forums.phpfreaks.com/topic/162933-timelinegantt-chart-using-php-mysql/
Share on other sites

I've looked at that and it seems pretty complicated. And my end use would likely fall under commercial use ("improving internal business efficiency" type thing, I guess).

 

I guess if that's where everyone is pointing me, my answer is probably that there is not an easy way to do a Gantt chart without some sort of pre-packaged code. That sucks because I only have 2 fields per item to track (start date and end date) and a label for the item (title).

 

Also, I don't necessarily want a Gantt chart - I want a timeline chart (in the format of a Gantt chart).

So essentially you have a multitude of items and only start/end dates? That shouldn't be too hard to whip up in PHP

 

That's what I'm trying to do.

 

I can even think of a way using a table to draw out the start date/end date bar and label the item with the project title, but what I can't figure out is how to dynamically present the linear timeline label of dates.

 

I figured it would be easier using some prepackaged code and modifying it, but I can't seem to find anything.

  • 2 months later...

Alright, what about this approach:

 

Make a table with the dates on the top, and the project names on the left (like in this little ASCII table below):

 

        J    J    J    J    J    F    F

        0    0    1    2    2    0    1

        1    8    5    2    9    5    2

 

        -------------------------------------

Alpha  |    |    |    |    |    |    |

        -------------------------------------

Bravo  |    |    |    |    |    |    |

        -------------------------------------

Charlie |    |    |    |    |    |    |

        -------------------------------------

Delta  |    |    |    |    |    |    |

        -------------------------------------

Echo    |    |    |    |    |    |    |

        -------------------------------------

 

Now, to make the chart, color the background in blue between two days, like so:

        J    J    J    J    J    F    F

        0    0    1    2    2    0    1

        1    8    5    2    9    5    2

 

        -------------------------------------

Alpha  |    |XXXXX|XXXXX|XXXXX|    |    |

        -------------------------------------

Bravo  |XXXXX|    |    |    |    |    |

        -------------------------------------

Charlie |    |    |    |    |XXXXX|XXXXX|

        -------------------------------------

Delta  |    |    |XXXXX|    |    |    |

        -------------------------------------

Echo    |    |XXXXX|    |    |    |    |

        -------------------------------------

 

Next up, take out the borders... and you should have something like this:

        J    J    J    J    J    F    F

        0    0    1    2    2    0    1

        1    8    5    2    9    5    2

 

                                           

Alpha        XXXXXXXXXXXXXXXXXXX           

                                           

Bravo  XXXXXXX                             

                                           

Charlie                        XXXXXXXXXXXXX

                                           

Delta              XXXXXXX                 

                                           

Echo          XXXXXXX                       

                                           

 

By the way, this took forever. :l

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.