diff --git a/core/control/Statistics.php b/core/control/Statistics.php index 50ba0ef73..b3298a361 100644 --- a/core/control/Statistics.php +++ b/core/control/Statistics.php @@ -57,7 +57,7 @@ END; $sum = 0; - $ds .= "{$class}Set: ["; + $ds .= "{$class}: ["; for($i = 1; $i <= $days; $i++) { @@ -332,6 +332,135 @@ var boptions = { axisLabelFontSize: 10, + padding: {left: 30, right: 0, top: 10, bottom: 30}, + + backgroundColor: '#cccccc', + + colorScheme: '{$color}',\n\n + +END; + $opts .= $xt . "]\n};"; + + + return $top . $ds . "\n};\n\n" . $opts . "\n\n" . $bot; + } + + static function OSChart($type = "Pie", $color = "blue") { + $top = << +

Operating Systems

+
+ + + +END; + + $ds = "var ochartdata = { \n'Set': ["; + + $records = DataObject::get('PageView'); + $oss = array(); + foreach($records as $r) { + $ra = $r->toMap(); + $cb = $ra['OS']; + if($oss[$cb] >= 1) { + $oss[$cb]++; + } else { + $oss[$cb] = 1; + } + } + + $xt = "xTicks: ["; + $i = 0; + foreach($oss as $bn => $bc) { + $ds .= "[{$i}, {$bc}], "; + $xt .= "{v:" . $i . ", label:'" . $bn . "'}, "; + $i++; + } + $ds .= "]\n"; + + $opts = << +

User Activity

+
+ + + +END; + + $ds = "var uacchartdata = { \n'Set': ["; + + $records = DataObject::get('PageView'); + $users = array(); + foreach($records as $r) { + $ra = $r->toMap(); + $cb = $ra['UserID']; + if($cb == -1) { + continue; + } + if($users[$cb] >= 1) { + $users[$cb]++; + } else { + $users[$cb] = 1; + } + } + + $xt = "xTicks: ["; + $i = 0; + foreach($users as $bn => $bc) { + $ds .= "[{$i}, {$bc}], "; + $xt .= "{v:" . $i . ", label:'" . $bn . "'}, "; + $i++; + } + $ds .= "]\n"; + + $opts = <<