You are here

function hook_analytics_dashboard in Google Chart Tools 7

Implements hook_analytics_dashboard().

1 function implements hook_analytics_dashboard()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

analytics_dashboard_analytics_dashboard in analytics_dashboard/analytics_dashboard.module
Implements hook_analytics_dashboard().
1 invocation of hook_analytics_dashboard()
analytics_dashboard_get_charts in analytics_dashboard/analytics_dashboard.module
Fetch all available analytics_dashboard charts

File

analytics_dashboard/analytics_dashboard.api.php, line 10
Analytics Dashboard API definitions.

Code

function hook_analytics_dashboard() {
  $voc = taxonomy_vocabulary_machine_name_load('categories');
  $tree = taxonomy_get_tree($voc->vid);
  $header = array();
  foreach ($tree as $term) {
    $header[] = $term->name;
    $query = db_select('taxonomy_index', 'ti');
    $query
      ->condition('ti.tid', $term->tid, '=')
      ->fields('ti', array(
      'nid',
    ));
    $terms[] = $query
      ->countQuery()
      ->execute()
      ->fetchField();
  }
  $columns = array(
    'Ideas in category',
  );
  $rows = array(
    $terms,
  );
  $settings = array();
  $settings['chart']['chartCategory'] = array(
    'header' => $header,
    'rows' => $rows,
    'columns' => $columns,
    'weight' => -10,
    'chartType' => 'PieChart',
    'options' => array(
      'curveType' => "function",
      'is3D' => TRUE,
      'forceIFrame' => FALSE,
      'title' => 'Ideas per category',
      'width' => 500,
      'height' => 300,
    ),
  );
  return draw_chart($settings);
}