You are here

Charts and Graphs - Open Flash Chart 2 in Charts and Graphs 6.2

Same filename and directory in other branches
  1. 6 help/opencharts.html
  2. 7 help/opencharts.html

Library pages

For definitive info about Open Flash Chart 2 library please see it's home page, it's tutorial page, it's charts types reference pages and it's properties reference pages.

Installation

You need to get Open Flash Chart SWF file as it's LGPL and so can't be included in this module release files. Download latest Open Flash Chart 2 release and dump the open-flash-chart.swf file into sites/all/modules/charts_graphs/apis/charts_graphs_open_flash.

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.
    1. Enable SWFObject2 module.
    2. 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.
  4. AmCharts should work with all embedding methods, but we highly recommend using it with SWFObject2.

Usage

The quickest code to get something graphed using Open Flash Chart 2:

<?php
function charts_graphs_test() {
  $canvas = charts_graphs_get_graph('open-flash');

  $canvas->title = 'Open Flash Chart 2 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;
}

Graph types supported

Open Flash Chart 2 supports all main graph types but none standardized graph types. It also supports the following graph types:

bar_3d
Bar graph with 3d effect bars.
bar_cylinder
Bar graph with cylinder effect bars.
bar_cylinder_outline
Bar graph with outlined cylinder effect bars.
bar_dome
Very similar to bar_round_glass but slightly rounded bottoms.
bar_filled
Bar graph with border around bars..
bar_glass
Bar graph with glass effect bars..
bar_round
Bar graph with glass effect bars and rounded tops and bottoms.
bar_round_glass
Bar graph with glass effect bars and rounded tops.
bar_sketch
Bar graph with sketched effect bars.

Unsupported properties

Open Flash Chart 2 has no themes defined to be used with the theme property.

Examples

The examples below will only work if you have the Open Flash Chart 2 submodule configured correctly.

File

help/opencharts.html
View source
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>Charts and Graphs - Open Flash Chart 2</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <h3>Library pages</h3>
    <p>For definitive info about Open Flash Chart 2 library please see it's
      <a href="http://teethgrinder.co.uk/open-flash-chart-2/">home page</a>,
      it's <a href="http://teethgrinder.co.uk/open-flash-chart-2/tutorial.php">
        tutorial page</a>, it's
        <a href="http://teethgrinder.co.uk/open-flash-chart-2/area-hollow.php">
          charts types reference pages</a> and it's
          <a href="http://teethgrinder.co.uk/open-flash-chart-2/x-axis.php">
            properties reference pages</a>.</p>
    <h3>Installation</h3>
    <p>You need to get Open Flash Chart SWF file as it's LGPL and so can't be 
      included in this module release files. Download latest
        <a href="http://sourceforge.net/projects/openflashchart/files/open-flash-chart/">
          Open Flash Chart 2 release</a> and dump the 
          <em>open-flash-chart.swf</em> file into 
          <i>sites/all/modules/charts_graphs/apis/charts_graphs_open_flash</i>.</p>
    <h4>Install and Configure SWFTools</h4>
    <ol>
      <li>Download and enable 
        <a href="http://drupal.org/project/swftools">SWFTools</a></li>
      <li>Download: http://code.google.com/p/swfobject zip file, extract
        <i>swfobject.js</i> and copy it to
        <i>sites/all/modules/swftools/shared/swfobject2/swfobject.js</i></li>
      <li>At this point, you should be able to start using OpenFlashCharts, but 
        it is highly recommended that you complete following two steps as well.
        <ol>
          <li>Enable SWFObject2 module.</li>
          <li>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.</li>
        </ol>
      </li>
      <li> AmCharts should work with all embedding methods, but we highly 
        recommend using it with SWFObject2.</li>
    </ol>
    <h3>Usage</h3>
    <p>The quickest code to get something graphed using Open Flash Chart 2:</p>
<pre>
&lt;?php
function charts_graphs_test() {
  $canvas = charts_graphs_get_graph('open-flash');

  $canvas->title = 'Open Flash Chart 2 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;
}
</pre>
    <h3>Graph types supported</h3>
    <p>Open Flash Chart 2 supports all <a href="general_reference#type">main</a>
      graph types but none
      <a href="general_reference#other_standardized_types">standardized graph</a>
      types. It also supports the following graph types:</p>
    <dl>
      <dt>bar_3d</dt>
        <dd>Bar graph with 3d effect bars.</dd>
      <dt>bar_cylinder</dt>
        <dd>Bar graph with cylinder effect bars.</dd>
      <dt>bar_cylinder_outline</dt>
        <dd>Bar graph with outlined cylinder effect bars.</dd>
      <dt>bar_dome</dt>
        <dd>Very similar to bar_round_glass but slightly rounded bottoms.</dd>
      <dt>bar_filled</dt>
        <dd>Bar graph with border around bars..</dd>
      <dt>bar_glass</dt>
        <dd>Bar graph with glass effect bars..</dd>
      <dt>bar_round</dt>
        <dd>Bar graph with glass effect bars and rounded tops and bottoms.</dd>
      <dt>bar_round_glass</dt>
        <dd>Bar graph with glass effect bars and rounded tops.</dd>
      <dt>bar_sketch</dt>
        <dd>Bar graph with sketched effect bars.</dd>
    </dl>
    <h3>Unsupported properties</h3>
      <p>Open Flash Chart 2 has no themes defined to be used with the
        <a href="general_reference#theme">theme</a> property.</p>
    <h3>Examples</h3>
    <p>The examples below will only work if you have the Open Flash Chart 2
      submodule configured correctly.</p>
    <ul>
      <li><a href="/charts_graphs/test/open-flash/line/Open%20Flash%20Chart%202%20-%20Line%20example">Line example</a></li>
      <li><a href="/charts_graphs/test/open-flash/bar/Open%20Flash%20Chart%202%20-%20Bar%20example">Bar example</a></li>
      <li><a href="/charts_graphs/test/open-flash/pie/Open%20Flash%20Chart%202%20-%20Pie%20example">Pie example</a></li>
    </ul>
  </body>
</html>