Using OpenFlashCharts

Last updated on
30 April 2025

Note: The OpenFlash submodule is only tested on Drupal 6.

Installation

  1. You don't necessarily need to download OpenFlashCharts SWF file, since the package is LGPL, it can be packaged with the module, and is included in the corresponding sub-module's download. If you still want to download it yourself or need to update a version, download latest OpenFlashCharts2 swf file from: http://sourceforge.net/projects/openflashchart/files/ and dump into sites/all/modules/charts_graphs/charts_openflash
  2. Install and Configure SWFTools:
    1. Download and enable SWFTools
    2. Download: http://code.google.com/p/swfobject zip file, extract swfobject.js and copy it to sites/all/modules/swftools/shared/swfobject2/swfobject.js
    3. At this point, you should be able to start using OpenFlashCharts, but it is highly recommended that you complete following two steps as well.
    4. Enable SWFObject2 module.
    5. Go to SWFTools embeding configuration located at: http://example.com/admin/settings/swftools/embed and under "Embedding Methods", make "SWFObject 2 - JavaScript" the default method.
    6. OpenFlashCharts should work with all embedding methods, but we highly recommend using it with SWFObject2.

Usage

The quickest code to get something graphed using OpenFlashCharts2:

Call this function, charts_graphs_test(), from your code to see if it works.


function charts_graphs_test() {
   $canvas = charts_graphs_get_graph('open-flash');
    
  $canvas->title = "OpenFlashCharts Chart";
  $canvas->type = "line"; 
  $canvas->y_legend = "Y Legend";
  $canvas->colour = '#808000';
  $canvas->width = 700;
  $canvas->height = 300;
  $canvas->series = array(
    'Some Value' => array(9,6,7,9,5,7,6,9,7),
    'Page Views' => array(6,7,9,5,7,6,9,7,3),
  );
  $canvas->x_labels = array('one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine');
  
  $out = $canvas->get_chart();

  return $out;
}

Chart Types Supported

[line] => Line
[bar_3d] => 3D Bar
[bar_glass] => Glass Bar
[pie] => Pie

Help improve this page

Page status: Not set

You can: