Drupal 6: Integrating Open Flash Charts into a Drupal View
In this tutorial I’ll show how I integrated Open Flash Charts into a Drupal view to create a fancy flash based chart from CCK node data.
Let’s start by creating a new CCK node type to contain the data. I called mine “graph_data”.
I added an integer field called “field_data”.
I created a bunch of nodes, populating them with a random integer from 0 to 100.
I added a view called “Graph” to show all of my data. I filtered by node type and published, added sort criteria, chose “Unformatted” for Style, chose how many items to show (100), and added a page view.
At this point, you’ll need to download and incorporate the Open Flash Charts library. You can download the library here or by visiting their website and clicking on Downloads in the top right. Uncompress the download and copy the entire directory (version-2-ichor) into your theme directory.
Sample directory structure:
I created a new file in my theme directory called “views-view-unformatted–Graph.tpl.php” (see: Theme Information section on the View edit page) to override it’s output. I put the guts of my code in this file:
Here’s a screenshot of my new flash integrated view: