update to current plugin versions
[opensuse:lizards_o_o.git] / wp-content / plugins / wp-statpress / includes / charts.php
1 <?php
2
3
4 function iriGoogleChart($title,$size,$data_array) {
5         if(empty($data_array)) { return ''; }
6         // get hash
7         foreach($data_array as $key => $value ) {
8                 $values[] = $value;
9                 $labels[] = $key;
10         }
11         $maxValue=max($values);
12         $simpleEncoding='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
13         $chartData="s:";
14         for($i=0;$i<count($values);$i++) {
15                 $currentValue=$values[$i];
16                 if($currentValue>-1) {
17                         $chartData.=substr($simpleEncoding,61*($currentValue/$maxValue),1);
18                 } else {
19                         $chartData.='_';
20                 }
21         }
22         $data=$chartData."&chxt=y&chxl=0:|0|".$maxValue;
23         return "<img src=http://chart.apis.google.com/chart?chtt=".urlencode($title)."&cht=p3&chs=$size&chd=".$data."&chl=".urlencode(implode("|",$labels)).">";
24 }
25
26
27 ?>