You are here

function chart_render in Google Chart Tools: Image Charts 6

Same name and namespace in other branches
  1. 5 chart.module \chart_render()

Renders a chart structure.

Parameters

array $chart:

array $attributes: (optional) Assoc array of attributes parsed by drupal_attributes();

Return value

mixed

  • Success: Chart image markup
  • Failure: FALSE
2 calls to chart_render()
chart_views_plugin_style_chart::render in chart_views/includes/views/chart_views_plugin_style_chart.inc
Define and display a chart from the grouped values.
system_charts_build in contrib/system_charts/system_charts.module
Gather data and build a chart API structure.

File

./chart.module, line 131
Provides Google chart API integration.

Code

function chart_render($chart, $attributes = array()) {
  if ($chart_query_string = chart_build($chart)) {
    $attributes['id'] = 'chart-' . $chart['#chart_id'];
    if (!isset($attributes['class'])) {
      $attributes['class'] = '';
    }
    $attributes['class'] .= ' chart';
    return '<img src="' . CHART_URI . '?' . $chart_query_string . '"' . drupal_attributes($attributes) . ' />';
  }
  else {
    return FALSE;
  }
}