function _chart_get_max in Google Chart Tools: Image Charts 7
Same name and namespace in other branches
- 5 chart.module \_chart_get_max()
- 6 chart.module \_chart_get_max()
Return the max value of a single or multi 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 788 - Provides primary Drupal hook implementations.
Code
function _chart_get_max(&$array) {
if (is_array(current($array))) {
//If a multi-level array
foreach ($array as &$subarray) {
$array_max = _chart_get_max($subarray);
if (!isset($max)) {
//Save the first value found as max
$max = $array_max;
}
else {
if ($array_max > $max) {
$max = $array_max;
}
}
}
return $max;
}
else {
//If a single level array
return max($array);
}
}