Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Drawing Graphs with PHP

1 view
Skip to first unread message

Nico

unread,
May 5, 2006, 5:00:17 AM5/5/06
to
Hi, I'm looking for a package useful to draw graphs (like those listed at
the page http://www.graphviz.org/, not general charts). Can you provide me
with some indication please? Many thanks!
Best,
Nic


Prince of Code

unread,
May 5, 2006, 7:27:27 AM5/5/06
to
hi,
The only option with which we draw graph in PHP is GD package. You can
device your algorithm to draw graphs. In fact graph are great area in
mathematics and computing.

Also pls check out in www.phpclasses.org if u hav any classes for the
purpose.

princeofcode

NC

unread,
May 5, 2006, 1:52:54 PM5/5/06
to
Nico wrote:
> I'm looking for a package useful to draw graphs (like those
> listed at the page http://www.graphviz.org/, not general charts).

How about Graphviz itself? The Graphviz resource page:

http://www.graphviz.org/Resources.php

mentions several PHP applications that use Graphviz, including a PEAR
class. Take a look at those; perhaps, one of them will help you figure
out how to make Graphviz work with PHP...

Cheers,
NC

Good Man

unread,
May 5, 2006, 3:50:09 PM5/5/06
to
"Nico" <nos...@nospam.nospam> wrote in
news:445b1429$0$29733$4faf...@reader2.news.tin.it:

http://www.aditus.nu/jpgraph/

NC

unread,
May 5, 2006, 3:57:15 PM5/5/06
to
Good Man wrote:
> "Nico" <nos...@nospam.nospam> wrote in
> news:445b1429$0$29733$4faf...@reader2.news.tin.it:
>
> > Hi, I'm looking for a package useful to draw graphs (like those listed
> > at the page http://www.graphviz.org/, not general charts).
>
> http://www.aditus.nu/jpgraph/

As much as I like JpGraph, it's probably not going to work too well;
the OP seems to want to draw tree charts, relationship diagrams, and
the like... For those, JpGraph will be a very minor improvement over
starting from scratch...

Cheers,
NC

Colin McKinnon

unread,
May 5, 2006, 7:49:29 PM5/5/06
to
NC wrote:

> Nico wrote:
>> I'm looking for a package useful to draw graphs (like those
>> listed at the page http://www.graphviz.org/, not general charts).
>
> How about Graphviz itself? The Graphviz resource page:
>
> http://www.graphviz.org/Resources.php

That's what I do - I generate dot files using PHP, and output them to a
temporary file (using a caching mechanism). The use the header() function
to tell the browser I'm sending it a Jpeg image.

Looks something like this:
<?php

...

$cache_name=get_cache_name();
if (not_cached($cache_name)) {
$dotfile=gen_dot_file();
$tmpfile=write_tmp_file($dotfile);
// this was a quick hack so I dumped the dot file into
// a temp file - but with a bit of effort you could
// send it to stdin instead
$run="/usr/bin/dot -Tjpg -o $cache_name $tmpfile";
$output=`$run`;
}
header("Content-type: image/jpeg");
readfile($cache_name);
?>

HTH

C.

Nico

unread,
May 6, 2006, 4:23:19 AM5/6/06
to
Many thanks!
I'll try graphviz.
Nic

"NC" <n...@iname.com> ha scritto nel messaggio
news:1146859035....@i40g2000cwc.googlegroups.com...

0 new messages