You are here

function draw_chart in Google Chart Tools 7

Draw the chart

4 calls to draw_chart()
analytics_dashboard_charts in analytics_dashboard/analytics_dashboard.charts.inc
@file Provides the charts definitions.
google_chart_tools_page in google_chart_tools_example/google_chart_tools_example.module
Creating graphs for the last 10 days of node creating, comments and votes.
google_chart_tools_views_plugin_style::render in google_chart_tools_views/views/google_chart_tools_views_plugin_style.inc
Render the display in this style.
hook_analytics_dashboard in analytics_dashboard/analytics_dashboard.api.php
Implements hook_analytics_dashboard().

File

./google_chart_tools.module, line 15

Code

function draw_chart($settings) {
  drupal_alter('draw_chart', $settings);
  foreach ($settings['chart'] as $id => $chart) {
    if (!isset($settings['chart'][$id]['containerId'])) {
      $settings['chart'][$id]['containerId'] = drupal_strtolower(str_replace(" ", "-", $id));
    }
  }
  drupal_add_css(drupal_get_path('module', 'google_chart_tools') . '/google_chart_tools.css');
  drupal_add_js(drupal_get_path('module', 'google_chart_tools') . '/google_chart_tools.js');
  drupal_add_js($settings, array(
    'type' => 'setting',
  ));
  $ret = array(
    'title' => $chart['options']['title'],
    'id' => $id,
    'weight' => isset($chart['weight']) ? $chart['weight'] : 0,
    'markup' => "<div id='{$settings['chart'][$id]['containerId']}'></div>",
  );
  return $ret;
}