You are here

function _google_charts_render in Charts 7

Same name and namespace in other branches
  1. 6 google_charts/google_charts.inc \_google_charts_render()

Implementation of hook_charts_render().

Its a Charts module hook. It transform the data into a HTML chart.

Parameters

&$data: Array. The

1 string reference to '_google_charts_render'
google_charts_charts_info in google_charts/google_charts.hooks.inc
Implementation of hook_charts_info().

File

google_charts/google_charts.inc, line 105
@author Bruno Massa http://drupal.org/user/67164

Code

function _google_charts_render(&$data) {
  $chart = array();
  if ($message = _google_charts_chart($chart, $data)) {
    return $message;
  }

  // Convert the chat DATA into the Google Chart way.
  // Since its a requirement to build the chart on Google, if the value
  // was not found, return nothing and stop the execution.
  if ($message = _google_charts_series($chart, $data)) {
    return $message;
  }

  // If its all ok, build the HTML img tag
  return '<img src="http://chart.apis.google.com/chart?' . implode('&amp;', $chart) . '" />';
}