You are here

function theme_chart in Google Chart Tools: Image Charts 7

Renders a chart element.

Parameters

$variables: An associative array containing:

  • chart: An associative array definining a chart.
2 theme calls to theme_chart()
chart_views_plugin_style_chart::render in chart_views/views/chart_views_plugin_style_chart.inc
Render the display in this style.
system_charts_build in system_charts/system_charts.module
Gather data and build a chart API structure.

File

./chart.module, line 139
Provides primary Drupal hook implementations.

Code

function theme_chart($variables) {
  $chart = $variables['chart'];
  if (chart_build($chart)) {
    $chart['#attributes']['id'] = 'chart-' . $chart['#chart_id'];
    $chart['#attributes']['class'][] = 'chart';
    return theme('image', array(
      'path' => chart_url($chart),
      'attributes' => $chart['#attributes'],
      'alt' => $chart['#title'] ? $chart['#title'] : t('Chart'),
    ));
  }
  return '';
}