You are here

function chart_url in Google Chart Tools: Image Charts 7

Same name and namespace in other branches
  1. 6 chart.module \chart_url()

Returns the chart URL.

Parameters

array $chart:

Return value

mixed

  • Success: Chart image markup
  • Failure: FALSE
2 calls to chart_url()
chart_copy in ./chart.module
Copies rendered chart image.
theme_chart in ./chart.module
Renders a chart element.

File

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

Code

function chart_url($chart) {
  $count =& drupal_static(__FUNCTION__);
  if (!isset($count) || $count > 9) {

    //To use all 11 URLS, counting starts at -1
    $count = -1;
  }
  if ($data = chart_build($chart)) {
    if ($count < 0) {

      //First chart uses standard URI.
      $uri = CHART_URI;
    }
    else {

      // http://code.google.com/apis/chart/docs/making_charts.html#enhancements
      // Next 10 charts use multi URI with prefix.
      $uri = $count . CHART_MULTI_URI;
    }
    $count++;
    return url('//' . $uri, array(
      'query' => $data,
      'external' => TRUE,
    ));
  }
  return FALSE;
}