Library pages

For definitive info about amCharts library please see it's home page and it's reference page.

Instalation

You need to download amCharts files. Specifically Column & Bar, Line & Area, Pie & Donut zip files.

Unfortunately amCharts ships as several zips with sophisticated folder structure in each one of them. You need to hunt down the following files:

Download and place them in the downloaded folder of the module, directly, without any folder structure inside the downloaded folder.

Dependency

amCharts implementation for Charts and Graphs dependends on the SWFTools module.

At this point, you should be able to start using AmCharts, but it is highly recommended that you complete following three steps as well:

  1. download: http://code.google.com/p/swfobject zip file, extract it and copy the swfobject.js file to sites/all/modules/swftools/shared/swfobject2/swfobject.js
  2. enable SWFObject2 module
  3. go to SWFTools embeding configuration located at: http://yourdomain.com/admin/settings/swftools/embed and under Embedding Methods make SWFObject 2 - JavaScript the default method

Usage

The quickest code to get something graphed using AmCharts:

<?php
function charts_graphs_test() {
  $canvas = chart_graphs_get_graph('amcharts');

  $canvas->title = 'AmCharts Chart';
  $canvas->type = 'line';
  $canvas->y_legend = 'Y Legend';
  $canvas->colour = '#808000';
  $canvas->theme = 'keynote';
  $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

amCharts supports all main and standardized graph types. It also supports the following graph types:

100_stacked_bar
Stacked bar where columns equalized at the same height and values take up a percentage of each column.
bar_3d
Columns are 3D and are positioned one behind another.
100_stacked_side_bar
Stacked side bar where columns equalized at the same width and values take up a percentage of each column.
side_bar_3d
3D side bars positioned one behind another.

Examples

The examples below will only work if you have the amCharts submodule configured correctly.