You are here

function _chart_override_aspect in Google Chart Tools: Image Charts 5

Same name and namespace in other branches
  1. 6 chart.module \_chart_override_aspect()
  2. 7 chart.module \_chart_override_aspect()

Override the default chart aspect ratio.

1 call to _chart_override_aspect()
_chart_append in ./chart.module
When the value passed is valid append a chart API attribute and parsed values to $data.

File

./chart.module, line 633
Google Charting API. Developed by Tj Holowaychuk

Code

function _chart_override_aspect(&$width, &$height) {
  $decrement = 20;
  $max_width = variable_get('chart_max_width', FALSE);
  $max_height = variable_get('chart_max_height', FALSE);
  if (!$max_width && !$max_height) {
    return;
  }

  // Width
  if ($max_width) {
    while ($width > $max_width) {
      $width -= $decrement;
      $height -= $decrement;
    }
  }

  // Height
  if ($max_height) {
    while ($height > $max_height) {
      $width -= $decrement;
      $height -= $decrement;
    }
  }
}