Posted by Colin McKinnon on 05/06/06 02:49
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.
[Back to original message]
|