By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,435 Members | 1,967 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,435 IT Pros & Developers. It's quick & easy.

Has Anyone Coded Any Gantt Charts?

P: n/a
Hi there

Just before I sit down and re-invent the wheel, I was wondering if anyone
here has coded any Gantt charts (preferably 'week' style as opposed to
'month' style) and might have a class to share?

I've checked out phpclasses.org, and nothing quite suits my purposes. I
can hack one or two to turn it into what I need, but hey, might as well
check here first!

Thanks.

Apr 20 '06 #1
Share this Question
Share on Google+
18 Replies


P: n/a
Please have a closer look at
http://www.google.com/search?q=php+gantt

Apr 20 '06 #2

P: n/a
"milahu" <mi****@googlemail.com> wrote in news:1145567121.868018.244970
@g10g2000cwb.googlegroups.com:
Please have a closer look at
http://www.google.com/search?q=php+gantt


yes, obviously i have, there is nothing there that suits me.

essentially im looking for a gantt chart that does NOT get rendered as an
image (gif/png/jpg) and is more along the lines of HTML output.
Apr 20 '06 #3

P: n/a
On Thu, 20 Apr 2006 15:21:48 -0500, Good Man wrote:
Hi there

Just before I sit down and re-invent the wheel, I was wondering if anyone
here has coded any Gantt charts (preferably 'week' style as opposed to
'month' style) and might have a class to share?

I've checked out phpclasses.org, and nothing quite suits my purposes. I
can hack one or two to turn it into what I need, but hey, might as well
check here first!

Thanks.


Try jpgraph (http://www.aditus.nu/jpgraph/index.php)

--
http://www.mgogala.com

Apr 21 '06 #4

P: n/a
Mladen Gogala <go****@sbcglobal.net> wrote in
news:pa****************************@sbcglobal.net:
On Thu, 20 Apr 2006 15:21:48 -0500, Good Man wrote:
Hi there

Just before I sit down and re-invent the wheel, I was wondering if
anyone here has coded any Gantt charts (preferably 'week' style as
opposed to 'month' style) and might have a class to share?

I've checked out phpclasses.org, and nothing quite suits my purposes.
I can hack one or two to turn it into what I need, but hey, might as
well check here first!

Thanks.


Try jpgraph (http://www.aditus.nu/jpgraph/index.php)


yeah it's pretty sweet, but ultimately i'd be looking for html output, as i
will need to make links out of events, etc. it looks like i might have to
alter a class that produces images and customize it.

Apr 21 '06 #5

P: n/a
| > Try jpgraph (http://www.aditus.nu/jpgraph/index.php)
| >
|
| yeah it's pretty sweet, but ultimately i'd be looking for html output, as
i
| will need to make links out of events, etc. it looks like i might have to
| alter a class that produces images and customize it.

that's what i wanted to hear! knowing exactly why html over an image is
important. have you thought of combining two wheels rather than inventing
one? bad play on words...what i mean is to utilize the image and only use
html where it's absolutely needed? consider how many browsers there are to
support, how differently they render even simple html...then, how difficult
it will be to manage it all with html?

it can be done...but have you thought of perhaps simply altering the php
classes that produce image based charts and tie in html to those key
functions you need...say, using image mapping and javascript? creating the
mapping would be super easy since you typically only have to deal with
rectangular (regular) shapes...no complicated definitions of areas.

an approach like that may have you up and running in a couple of days rather
than a couple of weeks.

just a thought.

best of luck.

(no haiku intended ;^)
Apr 21 '06 #6

P: n/a
Rik
robert wrote:
yeah it's pretty sweet, but ultimately i'd be looking for html
output, as i will need to make links out of events, etc. it looks
like i might have to alter a class that produces images and
customize it.

consider how
many browsers there are to support, how differently they render even
simple html...then, how difficult it will be to manage it all with
html?

it can be done...but have you thought of perhaps simply altering the
php classes that produce image based charts and tie in html to those
key functions you need...say, using image mapping and javascript?

Euhm.... saying HTML is rendered very differently on browsers and then
advising javascript? That's even more of a gamble in different browsers.

I say: if it's possible in HTML, go for it. Semantically logical
information, and keeping images / client-side script to a minimum increases
accessability (?... pff english..) and reduces bandwith and probably server
load.

Grtz
--
Rik
Apr 21 '06 #7

P: n/a

"Rik" <lu************@hotmail.com> wrote in message
news:e2**********@netlx020.civ.utwente.nl...
| robert wrote:
| >> yeah it's pretty sweet, but ultimately i'd be looking for html
| >> output, as i will need to make links out of events, etc. it looks
| >> like i might have to alter a class that produces images and
| >> customize it.
| > consider how
| > many browsers there are to support, how differently they render even
| > simple html...then, how difficult it will be to manage it all with
| > html?
| >
| > it can be done...but have you thought of perhaps simply altering the
| > php classes that produce image based charts and tie in html to those
| > key functions you need...say, using image mapping and javascript?
|
|
| Euhm.... saying HTML is rendered very differently on browsers and then
| advising javascript? That's even more of a gamble in different browsers.

euhm's aside. the js is most likely going to handle a non-complex function
like an onclick event. now that's vs. generating an entire html based gannt
chart with all of it's elements and pieces...while maintaining it's visual
aspects, then has to still deliver it's functionality...and that, probably a
js handled onclick event. now, would you like to add more sarcasm?

| I say: if it's possible in HTML, go for it. Semantically logical
| information, and keeping images / client-side script to a minimum
increases
| accessability (?... pff english..) and reduces bandwith and probably
server
| load.

sure it's possible...probably not the best route to go though. you do
realize your arg. for not using client-side code here is that it reduces
bandwidth and server load? let me bring it home...if the client is doing
less of the processing...there must be something else doing more of the
processing...i think that would be the server. ;^) as for bandwidth, if the
server is picking up the load (since you don't want the client to), then any
extra functionality beyond initial delivery of content will mean another
trip to the server to get it...hmmm...let's forget "semantically" and just
stick to the "logical" arguments...perhaps then, you'll grasp it and realize
your above statement is less than well thought out.

now if you can think outside of the "i'm smarter than you" mentality it
seems you prefer, you'd also know that image mapping doesn't have to be
client-side and the server is fully capable of handling as much of this as
you want it too. if you're worried that js won't work in a browser...just
have the server process it. either way, you can't say "have the client
process this to reduce server load" and in the same breath say "client side
processing is a bad idea". what i'm saying is that you can choose a simple
solution without having to completely start from scratch...and it's flexible
enough to work in more than one fashion.

aside from your patronization attempts, why not make yourself useful and
address the op...because surely out of all your responses/criticisms, you
must have more genius to display than "go for it".
Apr 21 '06 #8

P: n/a
NC
Good Man wrote:

Just before I sit down and re-invent the wheel, I was wondering if
anyone here has coded any Gantt charts (preferably 'week' style as
opposed to 'month' style) and might have a class to share? .... ultimately i'd be looking for html output, as i will need to make
links out of events, etc.


It should be fairly simple... In PHP 4, you could write:

Class GanttChart {
var $activities;
var $start;
var $end;
var $unit;
function GanttChart ($start = 0, $end = 0, $unit = 'weeks') {
$this->start = $start;
$this->end = $end;
$this->unit = $unit;
$this->activities = array();
}
function AddActivity ($description, $start, $end, $color) {
$this->activities[] = array('start' => $start, 'end' => $end,
'description' => $description, 'color' => $color);
$this->start = min($this->start, $start);
$this->end = max($this->end, $end);
}
function Render ($unit_width = 50) {
$duration = $this->end - $this->start;
echo "<table border=0 cellspacing=0 cellpadding=2>\r\n";
echo "<tr><th colspan=$duration>", strtoupper($this->unit),
"\r\n<tr>\r\n";
for ($i = $this->start; $i <= $this->end; $i++) {
echo "<th width=$unit_width>$i";
}
foreach ($this->activities as $activity) {
$start = $activity['start'];
$end = $activity['end'];
$description = $activity['description'];
$color = $activity['color'];
$before = $start;
$duration = $end - $start + 1;
$after = $this->end - $end;
echo "<tr>\r\n";
if ($before > 0) {
echo "<td colspan=$before>&nbsp;\r\n";
}
echo "<td colspan=$duration align=center
bgcolor=$color>$description\r\n";
if ($after > 0) {
echo "<td colspan=$after>&nbsp;\r\n";
}
}
echo "</table>\r\n";
}
}

Usage example:

$G = new GanttChart();
$G->AddActivity('First Activity', 0, 5, 'red');
$G->AddActivity('Second Activity', 6, 15, 'yellow');
$G->AddActivity('Third Activity', 4, 11, '#40f040');
$G->Render();

HTML has been kept to a minimum for clarity; you can beautify it all
you want...

Cheers,
NC

Apr 21 '06 #9

P: n/a
"NC" <nc@iname.com> wrote in news:1145632126.048403.188970
@j33g2000cwa.googlegroups.com:
It should be fairly simple... In PHP 4, you could write: <snip> HTML has been kept to a minimum for clarity; you can beautify it all
you want...


Holy smokes! This is perfect for setting me on my way. Many, many thanks.
Apr 21 '06 #10

P: n/a
"robert" <ab@nospam.com> wrote in news:Vg***********@fe05.lga:

"Rik" <lu************@hotmail.com> wrote in message | Euhm.... saying HTML is rendered very differently on browsers and
| then advising javascript? That's even more of a gamble in different
| browsers.

euhm's aside. the js is most likely going to handle a non-complex
function like an onclick event. now that's vs. generating an entire
html based gannt chart with all of it's elements and pieces...while
maintaining it's visual aspects, then has to still deliver it's
functionality...and that, probably a js handled onclick event. now,
would you like to add more sarcasm?


just to add a couple thoughts to the thread (now-now fellas, play nice).

It's true that going with the various working (and in the case of
JpGraph, fabulous) image solutions to my Gantt quest would probably get
things going quickly. However, HTML just gives me much more flexibility
design-wise (CSS styles, for example) and functionality wise (AJAX calls
to fetch more information about a task when moused over, etc).

The poster 'NC' has set me on my way.

Thanks for the thoughts/thread/help.

Apr 21 '06 #11

P: n/a
"NC" <nc@iname.com> wrote in news:1145632126.048403.188970
@j33g2000cwa.googlegroups.com:
Good Man wrote:
It should be fairly simple... In PHP 4, you could write:


I'm also going to take this opportunity to finally delve into OO
programming.

Do you think I should change this to a PHP 5-style class?
Apr 21 '06 #12

P: n/a
NC
Good Man wrote:

Do you think I should change this to a PHP 5-style class?


It's entirely up to you. Right now, the only things you need to do to
make my GanttChart class PHP5-compliant are:

1. Rename the GanttChart() method into __construct(), and
2. Replace 'var' declarations with 'public' declarations.

Cheers,
NC

Apr 21 '06 #13

P: n/a
"NC" <nc@iname.com> wrote in news:1145634476.723222.159000
@t31g2000cwb.googlegroups.com:
It's entirely up to you. Right now, the only things you need to do to
make my GanttChart class PHP5-compliant are:

1. Rename the GanttChart() method into __construct(), and
2. Replace 'var' declarations with 'public' declarations.


Again, many thanks.

Apr 21 '06 #14

P: n/a
Rik
robert wrote:
yeah it's pretty sweet, but ultimately i'd be looking for html
output, as i will need to make links out of events, etc. it looks
like i might have to alter a class that produces images and
customize it.
consider how
many browsers there are to support, how differently they render even
simple html...then, how difficult it will be to manage it all with
html?

it can be done...but have you thought of perhaps simply altering the
php classes that produce image based charts and tie in html to those
key functions you need...say, using image mapping and javascript?
Euhm.... saying HTML is rendered very differently on browsers and
then advising javascript? That's even more of a gamble in different
browsers.


euhm's aside. the js is most likely going to handle a non-complex
function like an onclick event. now that's vs. generating an entire
html based gannt chart with all of it's elements and pieces...while
maintaining it's visual aspects, then has to still deliver it's
functionality...and that, probably a js handled onclick event. now,
would you like to add more sarcasm?


Server delivers HTML -> you''re absolutely sure what HTML arrives at the
client

Page relies heavily on js -> let's hope it works, and scripting is even
enabled...
I say: if it's possible in HTML, go for it. Semantically logical
information, and keeping images / client-side script to a minimum
increases accessability (?... pff english..) and reduces bandwith
and probably server load.


sure it's possible...probably not the best route to go though. you do
realize your arg. for not using client-side code here is that it
reduces bandwidth and server load?


Main argument here was accessability, not server load.
let me bring it home...if the
client is doing less of the processing...there must be something else
doing more of the processing...i think that would be the server. ;^)
as for bandwidth, if the server is picking up the load (since you
don't want the client to), then any extra functionality beyond
initial delivery of content will mean another trip to the server to
get it...hmmm...let's forget "semantically" and just stick to the
"logical" arguments...perhaps then, you'll grasp it and realize your
above statement is less than well thought out.
My statement was delivered somewhat poorly in this case, because I wanted to
stress a few general preferences in webpages:
1. If you want a functional element on you're webpage, and it doesn't have
to be an image, don't make it an image.
2. If you want dynamical functionality that can either be done server side
or client side, I'd prefer serverside: you're sure about the outcome, and
you'll have to do very little in browser-specific coding.

That's the point I was trying to make: it increases accessability
(cross-browser, even browsers for the visually impaired, plain-text browsers
etc.), and reliability: you're absolutely sure what HTML code is sent to the
client, which is semantically sound.

Yes, it's clear I have no fondness for js, every time I'm forced to use it I
feel a little bit sad.....
now if you can think outside of the "i'm smarter than you" mentality
it seems you prefer,
Pardon? Maybe it's because English isn't my native language, but that wasn't
the way I intended to come across. I merely wanted to express my thorough
preference of complete HTML instead of js.
you'd also know that image mapping doesn't have
to be client-side and the server is fully capable of handling as much
of this as you want it too.
I'm convinced that functionality shouldn't be in/behind/whatever images. You
can make it look like it by css, but everything on a website should work
with images disabled. Css is a wonderful method to make give it a nice
layout, in combination with logical HTML layout it makes a great page.
if you're worried that js won't work in a
browser...just have the server process it. either way, you can't say
"have the client process this to reduce server load" and in the same
breath say "client side processing is a bad idea".
Which reading back could be interpreted as such. Creating dynamical images
on server (unless they're cached in some way) is also a big server load.
"have the client process this to reduce server load" is something I'd rarely
say: For the client to process things it would have to get the information
from the server anyway, and I'd be curious what heavy load processing you'd
intended js to do. A few simple calculations while sending the information
wouldn't increase serverload that much, and I'm convinced complex processes
have no place in javascript.
what i'm saying is
that you can choose a simple solution without having to completely
start from scratch...and it's flexible enough to work in more than
one fashion.
Commercially correct, technically I have my doubts.
aside from your patronization attempts, why not make yourself useful
and address the op...because surely out of all your
responses/criticisms, you must have more genius to display than "go
for it".


Once again, I didn't mean to sound patronizing, I'm sorry. I have never
attempted to create Gantt-charts myself, so I'm not that much help in this
case. I applaud the op for wanting it in HTML though. And as far as I gather
he has a perfect solution now, with server sided code and plain HTML.

Still, I believe the statement:"Use javascipt, because HTML rendering in
browsers is unreliable." is utterly wrong, even backwards. I'd say:"Use
HTML, because javascript processing in browsers is unreliable."

In this particular case, could you tell me how the solution the op was
looking for and the answer he got for outputting HTML would be better, and
more reliable in javascript?

Grtz,
--
Rik
Apr 22 '06 #15

P: n/a
Rik
NC wrote:
Just before I sit down and re-invent the wheel, I was wondering if
anyone here has coded any Gantt charts (preferably 'week' style as
opposed to 'month' style) and might have a class to share? ...
ultimately i'd be looking for html output, as i will need to make
links out of events, etc.


It should be fairly simple... In PHP 4, you could write:


<SNIP>
HTML has been kept to a minimum for clarity; you can beautify it all
you want...


Such as ending cells (</td>) and quoting table-cell properties? :-)

Aside from that nice code

Grtz,
--
Rik
Apr 22 '06 #16

P: n/a
NC
Rik wrote:
NC wrote:
HTML has been kept to a minimum for clarity; you can beautify
it all you want...


Such as ending cells (</td>) and quoting table-cell properties? :-)


</td> is optional and has always been optional:

http://www.w3.org/TR/1999/REC-html40....html#h-11.2.6

Quoting the values of attributes is not required (although
recommended), if the values the values contain only Latin letters,
digits, hyphens (ASCII decimal 45), periods (ASCII decimal 46),
underscores (ASCII decimal 95), and colons (ASCII decimal 58):

http://www.w3.org/TR/html401/intro/sgmltut.html#h-3.2.2

Cheers,
NC

Apr 22 '06 #17

P: n/a
Rik
NC wrote:
Rik wrote:
NC wrote:
HTML has been kept to a minimum for clarity; you can beautify
it all you want...


Such as ending cells (</td>) and quoting table-cell properties? :-)


</td> is optional and has always been optional:

http://www.w3.org/TR/1999/REC-html40....html#h-11.2.6

Quoting the values of attributes is not required (although
recommended), if the values the values contain only Latin letters,
digits, hyphens (ASCII decimal 45), periods (ASCII decimal 46),
underscores (ASCII decimal 95), and colons (ASCII decimal 58):

http://www.w3.org/TR/html401/intro/sgmltut.html#h-3.2.2

Hmmmz, not making a good impression in this thread. Only made XHTML
lately...
Let's say it's indeed "beautifying" :-)

Grtz,
--
Rik Wasmus
Apr 22 '06 #18

P: n/a
I've just started an MS Project publisher application. Have not spnt
much time on it - but its here if you want a look.

http://www.programming.pwp.blueyonder.co.uk/index.htm

Regards,
Bob
On Fri, 21 Apr 2006 00:41:58 GMT, Mladen Gogala <go****@sbcglobal.net>
wrote:
On Thu, 20 Apr 2006 15:21:48 -0500, Good Man wrote:
Hi there

Just before I sit down and re-invent the wheel, I was wondering if anyone
here has coded any Gantt charts (preferably 'week' style as opposed to
'month' style) and might have a class to share?

I've checked out phpclasses.org, and nothing quite suits my purposes. I
can hack one or two to turn it into what I need, but hey, might as well
check here first!

Thanks.


Try jpgraph (http://www.aditus.nu/jpgraph/index.php)

Apr 25 '06 #19

This discussion thread is closed

Replies have been disabled for this discussion.