I am working on a project that dynamically generates graphs using data from a MySQL database. Ideally I would like to do this in PHP, but my my school's server does not have GD libraries installed. Does anyone know of a method of dynamically generating graphs without using a graph library (such as jpgraph) that depends on GD--perhaps I should resort to someone else's applet?
Thanks,
Colorado
EDIT: Specifically, I'm looking to generate scatter plots.
Charts you could use: http://code.google.com/p/flot/
You could invoke an external program such as Gnuplot.
Demo
Since most modern browser support svg/canvas. You could draw it with javascript on the client side.
There are many flash based (Open Flash Charts) and javascript-jquery (jqplot) based charting modules. You can use one of them.
Related
Can anybody suggest me what should I do ?
I am generating the PDF report and in the report, I have to print the high chart graph. As high chart uses the javascript which will not execute in PDF file, So I have to create the graph on the server.
I read many posts, they suggest me that i have to create the image of that graph, but my question is how will I create the image to that graph ?
You could try using server-side "browser" or JS engine to generate your graphs; there are tools that can be used for that.
For that purpose I used those:
PhantomJS: some quirks regarding header/footers but a nice lot of examples on website
WkHTMLToPDF: highly customisable, but I had trouble setting timeouts properly so graphs are fully generated before PDF output
But there are others.
As Preuk says, phantomjs is a good choice and what I use, here's a guide to it on the Highcharts site: http://www.highcharts.com/news/56-improved-image-export-with-phantomjs
It can be fiddly to get going but works well once you get it up and running.
I'm looking for a PHP chart library, with a few specific criteria:
I can't use Google charts because, in at least one case, I need to be able to run on a private network with no internet access (ergo no Google).
I need to be able to produce bitmapped images (png, etc). SVG would also be nice, and Flash is acceptable as an extra, but the static bitmapped images are necessary (so a completely Flash chart would be unusable).
Open source preferred but commercial is acceptable.
Take a look at:
JpGraph
pChart
Another suggestion in PHP in addition to the already mentioned:
Topnew SVG Chart 5.5 or bChart - a simple PHP chart for older versions.
Hope this helps someone!
Try this new stuff:
http://www.highcharts.com/ written in javascript
I would recomment Flot - it's a client-side (javascript) charting library, but it does not requite an internet connection (you can host everything on the intranet). If you want a PHP wrapper for it, many frameworks come with it - for example, here's one for QCubed, the framework that I use: http://examples.qcu.be/assets/plugins/QFlot/example/qflot-timeseries.php
Try:
Open Flash Chart
Google Chart API
how do i (after getting the right stock prices from a source) show it on a "live graph". i'm looking for a php/ajax toolkit that allows me to create that graph live?
is that the right thing to use or a flash based solution is better?
are there 3rdparty sites that offer to create live graphs given input data?
Highcharts is probably what you need.
I recently started a new project to simplify the construction of a graph when using php:
http://aloiroberto.wordpress.com/2010/02/04/highcharts-php-library/
Also, Google Charts or Open Flash Chart are concrete possibilities (the latter will require Flash).
you can have a look at JPGRAPH. It is a wonderful library for creating wide variety of graphs.
As far as ajax is concerned this library outputs the graph as a picture file, so you can easily send the required parameters using ajax and build the graph dynamically using ajax.
PHPlot also is a free library: http://phplot.sourceforge.net, but compared to JPGraph it's rather limited. It also delivers a picture so you could grab that via AJAX and display it.
Birdeye has some incredibly powerful graphing tools. Check out the Birdeye Explorer to get a sense of what you can do with it.
Do you have any idea on how to create a chart in an Excel sheet programmatically from PHP ?
I know you can invoke the Excel COM object, but the server is running on a Linux machine...
I already use the excellent PHPExcel library but they do not offer the option to create charts.
Thanks !
Give Google Charts API a go.
Aonther option you could look at is RRD tool, see here
HTH
I think it's not a bad idea to use PHPs GD library like these
WS Charts
Bar graph tutorial
or JpGraph, I'm not sure of the internals but there is free PHP5 and PHP4 versions available
Google Charts is a nice idea.
I would use built-in PHP draw functions to generate a chart, though.
I don't believe that using Excel is the best way of generating a chart. Typically, with ASP.net, you would either write your own chart rendering, or you would use an external component to do this (liberal definition).
My suggestions:
Pipe the data into gnuplot, customize it and grab the output
Get a third party widget to send the data into and handle the user interaction (Highly recommended)
Write your own chartting control (free from licensing issues, but not worth the annoyances unless you really like doing graphics your self)
I'm looking for a way to draw directed graphs in PHP. (as in http://upload.wikimedia.org/wikipedia/commons/0/08/Directed_acyclic_graph.png). I want it to create an image of the graph just like GD can output an image.
I've googled a lot on this, but I only can find a lot of libraries for drawing graphs in general (with bars etc), not directed graphs.
P.S. I've tried using dot (the linux program) via system(), but unfortunately I have no permission to do that on the server. Also, I have no rights to install PHP extensions and stuff like that on the server, so it should work with normal PHP (ideally just by including a file).
Thanks in advance.
I found a PEAR interface to GraphViz; I have not used it before so can't give you any personal recommendation whether it's good or bad. (but perhaps that doesn't solve your problem since you say you can't install applications)
I'm not aware of any graph visualization implementation in php.
However I suggest you to consider drawing the graph with javascript, for instance with the canviz JS library which works on most browsers (yes, including IE 6 & 7, but not 8 currently).
After a quick Google search, I found graph.php, which in the comments states that it connects nodes through arcs, vice straight lines in the example provided, but may be a good step in the right direction.
Haven't tried it yet, but this looks very promising.
http://www.kylescholz.com/blog/2006/06/using_force_directed_graphs.html
I use php to generate json that is consumed by the d3 force-directed graph system. So the display is all handled client side, all I need to do is make the right json data structures...
-FT