views:

313

answers:

3

Hello,

I want to implement social networking graph for companies and employees in my PHP CRM System.

Do you know any php related technology or else can do this?

Thanks a lot.

Edit:

chart -> graph

+1  A: 

http://pchart.sourceforge.net/

Ahmet Kakıcı
I believe that garcon meant graph instead of chart.
Dan
@Ahmet and Dan, Thanks, i guess i misused the word "chart" and it should be "graph".
garcon1986
+3  A: 

If you can install software on your server, check out Graphviz which is great on drawing such diagrams and charts. It is called from the commandline so you have to use shell_exec in PHP.

Update: I made this example page: http://lajm.eu/emil/dump/graphviz/

Emil Vikström
@Emil, i need to install Graphviz on the server and use image_graphviz in php? And Isn't there any other technology can do draw chart?
garcon1986
IF you choose to use Graphviz, you have to install the program on the server. You can also install the Pear package Graphviz afterwards, so you can use predefined functions to build the chart. but you don't need the Pear package to run Graphviz, you can just as easily run it from the commandline with shell_exec().There are probably multiple choices of techniques, I just posted my favorite solution. You have to look through alternative options and choose the best one for you.
Emil Vikström
@Emil, have you ever implemented this kind of work? The data used by graphviz can be in the format of json or array? Because i just can use static data in dot file. Actually, i'm lost in how to use dynamic data from database. Do you have any guidance?
garcon1986
I would save the relations to a dot file or on STDIN (the file format is not hard), run Graphviz on that file and then return the result. The file can then be cached so you don't have to run it too often.
Emil Vikström
@Emil, I'm sorry I don't understand this sentence : "I would save the relations to a dot file or on STDIN". Could you explain it with more details? Thanks a lot.
garcon1986
Here's an example: http://lajm.eu/emil/dump/graphviz/
Emil Vikström
@Thanks for your time and patience, Emil, How could you put the data in your file: "emil.dot"? The data is from database or not? I have ever drawn a similar file, but i just input all the data and their relations. How could you save the relations to the dot file automatically?
garcon1986
You have to do that programatically. As you can see, it's just a list of relations with one name on each side (doesn't matter which order). You can do this by looping through an array of relations and just output them to the file using normal fwrite() calls.
Emil Vikström
@Thanks Emil, you mean you just use a mysql query, and then loop the result, and then use fwrite() function to write them into file? It's brilliant. I have never tried this. Thanks very much.
garcon1986
+1  A: 

Prefuse library: both Java and Flex implementations. You could serve an applet from your PHP system.

Dan
@thanks Dan, I think it's an amazing tool. It can be used in php?
garcon1986
You need to write a separate applet and serve it embedded in the HTML page the PHP will produce.
Dan