You are here

function _chart_get_max in Google Chart Tools: Image Charts 6

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

Return the max value of a single level array.

1 call to _chart_get_max()
_chart_adjust_resolution in ./chart.module
Adjusts chart data transforming values so that they may be represented properly within the given resolution for the selected encoding type.

File

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

Code

function _chart_get_max($array) {
  rsort($array, SORT_NUMERIC);
  $max = is_array($array[0]) ? 1 : $array[0];
  if (count($array)) {
    foreach ($array as $k => $v) {
      if (is_array($v)) {
        rsort($v, SORT_NUMERIC);
        if ($v[0] > $max) {
          $max = $v[0];
        }
      }
    }
  }
  return $max;
}