On Sun, 9 Nov 2003 10:49:52 +0100, TheDD <pa***@email.com> wrote:
i have a question:
is there any librairy for drawing graphs with PHP? Not graphs like
histogram or alike, but like a set of shapes linked together in a certain
way (like a flow chart or call graph).
I have found a script to handle the graph in memory but i can already do
that, my problem is to draw it (it an optimal way, and without crossing
links if possible).
The most popular free directed graph drawing library is the 'dot' program from
the Graphviz library:
http://www.research.att.com/sw/tools/graphviz/
It does a decent enough job for small-ish graphs (<50 nodes), can output in
various formats, including HTML image maps so you can make the nodes clickable.
Basically you'll have to output a file in the simple format that dot
understands describing the graph, and use system() or backticks `` to call dot
to render that to a file.
Doesn't guarantee optimal layout or zero crossing edges; it uses heuristics to
get a generally reasonable layout.
There are commercial packages that do a better job but they're mostly
incredibly expensive. The Graph Layout Toolkit from Tom Sawyer Software looked
impressive, but the quote they called back with had quite a few zeroes ;-)
--
Andy Hassall (an**@andyh.co.uk) icq(5747695) (
http://www.andyh.co.uk)
Space: disk usage analysis tool (
http://www.andyhsoftware.co.uk/space)