You are here: Re: Drawing Graphs with PHP « PHP Programming Language « IT news, forums, messages
Re: Drawing Graphs with PHP

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.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация