You are here

charts_graphs_amcharts.module in Charts and Graphs 7

Same filename and directory in other branches
  1. 6.2 apis/charts_graphs_amcharts/charts_graphs_amcharts.module

drupal module file implementing amcharts.

File

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

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

/**
 * Implements hook_chartgraph_provider().
 **/
function charts_graphs_amcharts_chartgraph_provider() {
  $provider = array(
    'path' => drupal_get_path('module', 'charts_graphs_amcharts') . '/charts_graphs_amcharts.class.inc',
    // must be full path
    'clazz' => 'ChartsGraphsAmcharts',
    // 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'),
      'donut_3d' => t('3D Donut'),
      'side_bar' => t('Side Bar'),
      'bar' => t('Bar'),
      'pie' => t('Pie'),
      'pie_3d' => t('3D 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'),
    ),
    'themes' => array(),
  );
  return (object) $provider;
}

/**
 * @todo Please document this function.
 * @see http://drupal.org/node/1354
 */
function charts_graphs_amcharts_menu() {
  $items = array();
  $items['charts_graphs_amcharts/getdata'] = array(
    'page callback' => 'charts_graphs_amcharts_get_data',
    'access arguments' => array(
      'access content',
    ),
    'type' => MENU_CALLBACK,
  );
  return $items;
}

/**
 * @todo Please document this function.
 * @see http://drupal.org/node/1354
 */
function charts_graphs_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_add_http_header('Content-Type', 'text/xml; charset=utf-8');
  print $ret;
  exit;
}

Functions

Namesort descending Description
charts_graphs_amcharts_chartgraph_provider Implements hook_chartgraph_provider().
charts_graphs_amcharts_get_data @todo Please document this function.
charts_graphs_amcharts_menu @todo Please document this function.