function _google_charts_data_codingsimple in Charts 6
Same name and namespace in other branches
- 7 google_charts/google_charts.inc \_google_charts_data_codingsimple()
Encode the Chart data into a Alphanumeric code, follwing the Google Chart API instruction. Its needed because there is a size limmit to URL strings. So we reduce the amount of characters.
It basicly uses a scale of 61 levels to represent each chart value. If a more precise scale is needed, see _google_charts_codingextended(), which produces a 4000 levels, but also a bigger URL string.
Parameters
$data: Array. A series of numeric data values
Return value
String. The string presentation of series data
1 call to _google_charts_data_codingsimple()
- _google_charts_series in google_charts/
google_charts.inc - Convert all Series-level data.
File
- google_charts/
google_charts.inc, line 86 - @author Bruno Massa http://drupal.org/user/67164
Code
function _google_charts_data_codingsimple($value, $max) {
// Set the list of characters and the size of the list
$simple = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
$simple_len = drupal_strlen($simple) - 1;
if ($value >= 0) {
return $simple[round($simple_len * $value / $max)];
}
else {
return '_';
}
}