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
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).

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.