dogmatic69 / dogmatic69/cakephp_google_plugin

data compression

Open
#13 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
62
Forks
7
PR merge metrics
No merged PRs in 30d

Description

";

// And here's the function

function chart_data($values) {

// Port of JavaScript from http://code.google.com/apis/chart/
// http://james.cridland.net/code

// First, find the maximum value from the values given

$maxValue = max($values);

// A list of encoding characters to help later, as per Google's example
$simpleEncoding = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';

$chartData = "s:";
for ($i = 0; $i < count($values); $i++) {
$currentValue = $values[$i];

```
if ($currentValue > -1) {
$chartData.=substr($simpleEncoding,61*($currentValue/$maxValue),1);
}
else {
$chartData.='_';
}
```

}

// Return the chart data - and let the Y axis to show the maximum value
return $chartData."&chxt=y&chxl=0:|0|".$maxValue;
}

?>

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.