You are here

amcharts.module in Charts and Graphs 6

drupal module file implementing amcharts.

File

apis/amcharts/amcharts.module
View source
<?php

/**
 * @file drupal module file implementing amcharts.
 */

/**
 * Implementation of hook_charts_graphs_provider().
 **/
function amcharts_chartgraph_provider() {
  $provider = array(
    'path' => dirname(__FILE__) . '/amcharts.class.inc',
    // must be full path
    'clazz' => 'ChartsAmcharts',
    // implementation class' name
    'name' => 'amcharts',
    // name used when invoking through a factory method
    'nice_name' => 'amCharts',
    'chart_types' => array(
      'line' => t('Line'),
      'area' => t('Area'),
      'donut' => t('Donut'),
      'side_bar' => t('Side Bar'),
      'bar' => t('Bar'),
      'pie' => t('Pie'),
      'stacked_area' => t('Stacked Area'),
      'stacker_bar' => t('Stacked Bar'),
      'stacked_side_bar' => t('Stacked Side Bar'),
      '100_stacked_bar' => t('100% Stacked Bar'),
      'bar_3d' => t('3D Bar'),
      '100_stacked_side_bar' => t('100% Stacked Side Bar'),
      'side_bar_3d' => t('3D Side Bar'),
    ),
  );
  return (object) $provider;
}
function amcharts_menu() {
  $items = array();
  $items['amcharts/getdata'] = array(
    'page callback' => 'amcharts_get_data',
    'access arguments' => array(
      'access content',
    ),
    'type' => MENU_CALLBACK,
  );
  return $items;
}
function amcharts_get_data() {
  $cid = check_plain($_GET['cid']);
  $op = check_plain(arg(2));
  if ($op != 'settings' && $op != 'data') {
    drupal_not_found();
    exit;
  }
  $cache = cache_get($cid);
  if (!$cache || empty($cache->data)) {
    drupal_not_found();
    exit;
  }
  $obj = $cache->data;
  $ret = $obj->{$op};
  drupal_set_header('Content-Type: text/xml; charset=utf-8');
  print $ret;
  exit;
}
function _____charts_openflash_data($cid = NULL) {
  $cache = cache_get($cid);
  if (!$cache) {
    drupal_not_found();
    exit;
  }
  $canvas = $cache->data;
  $chart = chart_graphs_get_graph('open-flash');
  $chart
    ->get_data_from_cache($cid);
}

Functions

Namesort descending Description
amcharts_chartgraph_provider Implementation of hook_charts_graphs_provider().
amcharts_get_data
amcharts_menu
_____charts_openflash_data