I had asked question like this long ago at WPTavern and it fizzled. Hope it fares better this time. 🙂
Drawing graphs can be done with multiple methods (generating image files, JS, Flash) and there are a lot of libraries available overall.
However there are some specific factors in context of WordPress:
-
it might be efficient to use lighter library with dependency on scripts bundled with WP (like jQuery);
-
it needs to be licensed under GPLv2 or compatible to fit in official repository (note that it has more harsh requirements than WP itself);
-
there are probably some specifics that make things easier/harder to use with WP techniques, like passing data to JavaScript with localization functions.
What libraries or other solutions had you used to build graphs in WordPress?
Please one thing per answer, so it is easier to discuss and vote on.
Google Chart API
Free service, that generates chart images (hosted and served by Google) from data in URL requests.
If you need something very specific and of fixed parameters it is easy to hardcode most of it and get away without any library (and licensing issues) at all.
Disadvantages:
Self-plug – I developed my own PHP wrapper for it, but it’s a bit stale at moment PHP class/WP plugin for Google Charts API.
Highcharts
Highcharts is a charting library written in pure JavaScript, offering an easy way of adding interactive charts to your web site or web application.
Supports:
License and Pricing
I have used it before but not in any WordPress project so i really can’t tell.
Libchart
Libchart is a free chart creation PHP library, that is extremely easy to use and has greatly documented
Fetures
License
Libchart is a free software distributed under the terms of the GNU General Public License (GPL).
FusionCharts Free
FusionCharts Free is a completely free and open-source Flash charting component. It empowers you to create animated and interactive Flash charts for your web applications, desktop applications and presentations.
Features
License
FusionCharts Free is dual licensed under the MIT (X11) and GNU GPL licenses.
Image_Graph
Image_Graph provides a set of classes that creates graphs/plots/charts based on (numerical) data.
Many different plot types are supported: Bar, line, area, step, impulse, scatter, radar, pie, map, candlestick, band, box & whisker and smoothed line, area and radar plots.
The graph is highly customizable, making it possible to get the exact look and feel that is required.
The output is controlled by a Image_Canvas, which facilitates easy output to many different output formats, amongst others, GD (PNG, JPEG, GIF, WBMP), PDF (using PDFLib), Scalable Vector Graphics (SVG).
License
LGPL
http://pear.php.net/package/Image_Graph (via)
gRaphaël
Official extension of popular Raphaël JavaScript library. Common core with smaller separate files for each chart type (pie, bar, line, dot).
Under MIT license (GPLv2 compatible).
Sadly has no official documentation, but there are some unofficial docs available.
Google Chart Tools (https://google-developers.appspot.com/chart/interactive/docs/index) has already been mentioned. Just two corrections to the description already given:
(1) When using that library, you populate the chart with data by handing a Google DataTable object to the appropriate functions. Since you build that DataTable in your own Javascript, the data being charted do not in fact travel over the network to Google and back (unless you retrieve them from a network source in the first place). So Google Chart Tools is no more or less suitable for sensitive data than any other Javascript-based charting tool.
See, for example, the “Data Policy” statement in the documentation for line charts:
(2) Interactive charts are possible: the API provides Javascript function calls for changing data values, and also for changing which rows and columns of data are visible.
Flot
Free canvas + JS based library, can create line charts out of the box, highly configurable. Plugins available for spider diagrams, piecharts, zooming, etc
Not to be confused with jqplot
License
MIT License
bChart
bChart 3.1
A simple PHP chart: easy to use