Take the 2-minute tour ×

I'm intrested in the best way to draw a graph: i have a network and i'd like to draw a map of it. I know how to use gd, but i don't know how to make this graph good for viewing: i mean no line crossing etc. So, i guess there must be some tools or even php classes for doing this (maybe for graphviz dot?). Any help will be great for me!

share|improve this question
add comment

4 Answers

up vote 2 down vote accepted

Well, maybe you could use the PEAR Image_GraphViz class?

share|improve this answer
i'll try, thanks! –  k102 May 5 '11 at 8:45
add comment

Personally, I'd off-load the work of drawing the graph to the browser.

A good Javascript graphing library such as gRaphael can draw the graph using vector graphics (ie SVG), and can look much better than most static images generated by PHP, and can have features which static images can't, such as popups when you roll-over data points.

If you do it this way, all your PHP code has to supply is the graph data.

Hope that helps.

share|improve this answer
great library, i'll use it someday, thanks! but it's not what i actually wanted: i don't need a chart but a picture like finite automata graph... maybe my english is poor, sorry. –  k102 May 11 '11 at 12:05
@k102 - fair enough. In that case, maybe the main Raphael library would be better for you than gRaphael? (Raphael a general-purpose graphics library, whereas gRaphael is an extention for it specific to drawing graphs) –  Spudley May 11 '11 at 12:10
add comment

As you've laready hinted at, the quickest and simplest approach is to use graphviz. Given the abstraction provided by the dot language, there's little point in providing a PHP abstraction layer on top of it.

share|improve this answer
thanks! but another question, what should i prefer: webdot or graphwiz? –  k102 May 5 '11 at 8:43
add comment

Use google! http://code.google.com/apis/visualization/documentation/using_overview.html#load_your_libraries

They have great graphs. You just need to present the information in the right matter for google to understand. It's pretty simple.

share|improve this answer
add comment

Your Answer


