You are here

Charts and Graphs - Open Charts Flash 2 in Charts and Graphs 6

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

Library pages

For definitive info about Open Charts Flash 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 don't necessarily need to download Open Flash Charts 2 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 and dump it into sites/all/modules/charts_graphs/charts_openflash.

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 OpenFlashCharts2:

<?php
function charts_graphs_test() {
  $canvas = chart_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;
}

Graph types supported

Open Charts Flash 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.

Examples

The examples below will only work if you have the Open Charts Flash 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 Charts Flash 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 Charts Flash 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 don't necessarily need to download Open Flash Charts 2 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
        <a href="http://sourceforge.net/projects/openflashchart/files/">
          OpenFlashCharts2 swf file</a> and dump it into
          <i>sites/all/modules/charts_graphs/charts_openflash</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.
        </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 OpenFlashCharts2:</p>
<pre>
&lt;?php
function charts_graphs_test() {
  $canvas = chart_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;
}
</pre>
    <h3>Graph types supported</h3>
    <p>Open Charts Flash 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>Examples</h3>
    <p>The examples below will only work if you have the Open Charts Flash 2
      submodule configured correctly.</p>
    <ul>
      <li><a href="/charts_graphs/test/open-flash/line/Open Charts Flash 2 - Line example">Line example</a></li>
      <li><a href="/charts_graphs/test/open-flash/bar/Open Charts Flash 2 - Bar example">Bar example</a></li>
      <li><a href="/charts_graphs/test/open-flash/pie/Open Charts Flash 2 - Pie example">Pie example</a></li>
    </ul>
  </body>
</html>