Episodes Server: charting in Drupal
For my Episodes module to become useful, you also need to be able to easily analyze the collected data, to make sense of it all. The Episodes Server module aggregates all data and presents it, to allow the user to find the episodes that are the best candidates for optimization.
Because this is just a small part of my bachelor thesis, I decided to KISS (Keep It Simple, Stupid), because this alone could be a master thesis on its own.
Clearly, the best way to present this, is through charts. Charting is old, is has existed for a long time. So you’d expect to find mature, complete solutions. It turned out my assumptions couldn’t have been farther from the truth.
Charting in Drupal is one of the most confusing and frustrating things you could do. Either the module is a wrapper around another API but limits you too much, or the underlying API is too limited itself.
My requirements were simple: I want horizontal bar charts, good looking charts and a usable API. I’ll go through all available modules one by one and cover their pros and cons briefly. That way, other Drupal developers have at least a starting point in evaluating charting solutions for Drupal.
Flot
- Drupal module
- Library
- Description: Flot is a pure Javascript plotting library for jQuery. It produces graphical plots of arbitrary datasets on-the-fly client-side.
- Pros:
- Cons:
- simple charts are easy with this simple API, but complex charts are hard or require weird data structures
- the Drupal flot module’s API makes the “simple” API even more vague/unclear to use
- the library doesn’t support horizontal bar charts
- requires JS
Charts
- Drupal module
- Description: a single wrapper API around Google Charts API, Open Flash Chart API and FusionCharts
- Pros:
- ability to switch to a different charting library more easily
- Cons:
- the wrapper API is too limiting: only a very small number of chart types are supported for each charting library
- the wrapper API doesn’t support horizontal bar charts
Open Flash Chart API {###open-flash-chart-api}
- Drupal module
- library
- Description: a large variety of different chart types rendered through Flash
- Pros:
- looks the same in all browsers (thanks to Flash)
- Cons:
- requires Flash
- the library doesn’t support horizontal bar charts
Chart API
- Drupal module
- library
- Description: uses the Google Chart API to render charts
- Pros:
- looks the same in all browsers (because they’re images)
- lightweight, reliable, no need for server side libraries or additional modules
- memory friendly (thanks Google for taking the hit!)
- Google Chart API has the widest range of chart types, including horizontal bar charts
- the Drupal module’s wrapper API allows you to use all of Google Chart API’s features
- excellent documentation (Google’s)
- Cons:
- requires an internet connection
Of course I tried Chart API, the best option available today, the latest. The end result looks very pleasing though!
(Note: I finished working on this more than 3 weeks ago, but didn’t find the time to blog about it until now.)
Comments
Similar article
Karen Stevenson of Lullabot just posted a similar article. It’s got more details than mine, but it’s still useful to read both (different/complementary information).
http://www.lullabot.com/articles/drupal-charting
another con for flot
One other con for flot is that the resulting images cannot be saved to the desktop. I guess that is a problem for the Flash based chart options as well.
The only way to save them is to take a screenshot.
Thanks for this writeup! It’s very useful to know your thoughts on this.
The disadvantage of Google
The disadvantage of Google Charts is of course that it only works when you’ve got internet access … the others can work offline as well.
The best system would be an open source version of Google Chart.
What's the latest?
I have been beating my head against the wall trying to make any of these charts work against the current Drupal 6.14.
Have there been any significant developments/improvements in Drupal charting? I have a customer that needs graphs of data recorded by subscribing users, but I have yet to see a chart on my site. grr…
In general or Episodes Server module's charts?
Are you talking about charts in Drupal in general or the charts generated by the Episodes Server module in specific?