draw binary tree with php - php

I'm looking for a good library / API to draw a binary tree using PHP.
I've tried using Image_GraphViz, but it doesn't seem to work. I've also looked at phpsyntaxtree, but its not documented.
Alternatively, I'm also looking for a jQuery plugin that does this. (just not this one because it has no documentation).
Thanks

My suggestion is to go with js, because vector graphs are nicer and you can add interactivity anytime.
Try raphael, a good (and perfectly documented) js graph library
homepage | tree graph demo

I still believe GraphViz is what you need. If you had a problem in using it, just post a question about the problem. It will be better than finding an alternative tool.

Related

Graph/Chart suggestions. Using PHP, jQuery - silverlight?

I'm programming a site using PHP, mysql and jQuery. I would really appreciate and hoping for some suggestions as to what I can use to create pie, bar and line charts, where I have the ability to change the actual graphic thats being shown. For example, if I wanted to have the bar graph use an army camouflage graphic and another one with flower pixels. I've done some looking around, but always found it helpful asking others for what they use or have seen.
Also any recommendations to using silverlight for this over any existing PHP and jQuery extensions?
Thanks in advance.
It would do you good to check out FusionCharts XT. It renders charts in JavaScript, which means your charts will work very well on iOS devices too.
With Silverlight, iOS devices are out.
FusionCharts XT can be used with jQuery too, with jQuery's syntax : http://docs.fusioncharts.com/charts/contents/?jQuery/Overview.html
As you're working with jQuery right now I think these must be good libraries for your use. Besides, the jQuery would extend your page's size up to 77kbs so try to use all benefits of it.
http://www.1stwebdesigner.com/css/top-jquery-chart-libraries-interactive-charts/
http://www.jqplot.com/

Is there any way to draw graph using zend framework

can we draw graph with zend framework. I so, how to do data thing ? Is there some online resource to get familiar with it.
Thanks
I'm not sure about Zend Framework, but I seriously recommend Google Chart Tools API. It's easy to use and customize and is pretty powerful!
Edit: When I last used it, I generated the data using plain old PHP by looking at a javascript example and spotting the pattern, then just having php echo's everywhere I need them.
For creating graphs use http://thejit.org/
It will take some brain power, but I would recommend looking into Dojo simply because Zend has some built view helpers for dojo. At the end of the day, your going to have to integrate what ever solution your pick yourself.

drawing "good" graphs in php

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!
Well, maybe you could use the PEAR Image_GraphViz class?
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.
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.
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.

Is there a good treeview control supports ajax searching,filtering?

I have been searching for a javascript treeview control which supports 'on the fly' searching, filtering (similar to auto complete box).
I found ExtJS which has that feature but it's too big (~800 KB js). I also like jquery TreeTable control but I'm not sure it supports that feature.
Please advise. Any suggestion is welcome, thanks a lot.
I suggest jstree, it does come along with some nice plugins, such as a json plugin to fetch nodes from a server, as well as a search plugin.
It's not a perfect solution for your desired search behavior but you may use this to your advantage:
"The search plugin enables searching for nodes whose title contains a given string, works on async trees too. All found nodes get the jstree-search class applied to their contained a nodes - you can use that class to style search results."
So if you know that all nodes get this class, you could easily hide all nodes beforehand and then let the search plugin add this class which overrides(!important) the display attribute of the css class.
You can take a look at this article 8 Useful JQuery TreeView Examples
Check out the TreeView component from obout.com. It's ASP.NET, though.
Try http://www.addobject.com/nlstree this is a commercial solution, but the best I have come across. Well documented, quite flexible and has a good overall performance. Its behavior can be easily extended using various events it exposes.
If this one doesn't work for your requirement, better start coding one.
Go for jstree. Its light and good.
800 KB in a web site or web application is not too much nowadays.
Enter Google, type "jquery treeview plugin" (instant search turned on) and you'll download about 250 KB and you didn't even blinked.
I'm not the big fan of Ext JS and I'm amazed of jQuery + jQuery UI + plugins + jQuery tools, etc. But Ext JS TreeView is incredibly useful and ready to be used.
There are lots of possibilities with TreeView (even TreeGrid, which I think is the TreeTable your are looking for).
You can also try to create your own Ext JS treeview bundle (they used to have an Ext JS builder, but it's not available any more) with just required dependencies.
I think the main problem when using Ext JS is when you draw complex interfaces, like:
http://dev.sencha.com/deploy/dev/examples/feed-viewer/view.html
http://dev.sencha.com/deploy/dev/examples/desktop/desktop.html
http://dev.sencha.com/deploy/dev/examples/calendar/index.html
But you can try a complex example of TreeView (a TreeGrid) and you'll see it's not too much:
http://dev.sencha.com/deploy/dev/examples/treegrid/treegrid.html
Hope this helps

How to visualizate simple dependency graphs using php?

Is there any libraries to visualizate simple dependency graphs?
I suppose that SVG is good solution.
GraphViz does a nice job for tiny graphs, but not for huge ones. If your graph is reasonlably large, try aiSee or have a look at the alternatives on this list.
I'm not sure about PHP libraries, but there's the tool called Graphviz which can be invoked from your PHP code and produce .SVG visialization of your graph.
I really like Google Chart API: http://code.google.com/intl/fr/apis/chart/
Really simple to implement and there are quite a lot of graph styles.
Checkout http://thejit.org/
I used http://www.aditus.nu/jpgraph/ for drawing simple graphs.
ChartDirector is the best, and it has a lot of flavors thus has versions for PHP/ASP/COM/VB/.NET/JSP/Java/ColdFusion/Perl/Python/Ruby/C++.
By learning one, you then be able to use in many programming languages.
The if you mean graphs like in "dependency graph", then Graphviz should be mentioned.

Categories