summaryrefslogtreecommitdiffstats
path: root/lib.php
diff options
context:
space:
mode:
authorRomain d'Alverny <rda@mageia.org>2012-09-04 15:51:34 +0000
committerRomain d'Alverny <rda@mageia.org>2012-09-04 15:51:34 +0000
commitf2122a8cd8500bb775b04971b48c6faaa1af2e0a (patch)
tree27c75b5792fbbe1fb4f7755f027eba5c8a29db92 /lib.php
parent13426e1a3df985b8547455b3a0257039653603f9 (diff)
downloadpkgsubmit-f2122a8cd8500bb775b04971b48c6faaa1af2e0a.tar
pkgsubmit-f2122a8cd8500bb775b04971b48c6faaa1af2e0a.tar.gz
pkgsubmit-f2122a8cd8500bb775b04971b48c6faaa1af2e0a.tar.bz2
pkgsubmit-f2122a8cd8500bb775b04971b48c6faaa1af2e0a.tar.xz
pkgsubmit-f2122a8cd8500bb775b04971b48c6faaa1af2e0a.zip
adjust charts
Diffstat (limited to 'lib.php')
-rw-r--r--lib.php57
1 files changed, 36 insertions, 21 deletions
diff --git a/lib.php b/lib.php
index 5d1cfde..b6d6750 100644
--- a/lib.php
+++ b/lib.php
@@ -294,23 +294,39 @@ S;
public static function js_draw_buildtime_chart($data, $id)
{
- $d = print_r($data, true);
- $rows = array("['Duration', 'Builds']", '[1, 3]');
+ // first pass
+ $newdata = array();
foreach ($data as $duration => $count) {
+ if (false !== strpos($duration, 'hour')) {
+ $newdata['> 1 hour'] += $count;
+ } else {
+ $d = explode(' ', $duration);
+ if ($d[0] > 15) {
+ $newdata['> 15 minutes'] += $count;
+ } else {
+ $newdata[$duration] = $count;
+ }
+ }
+ }
+
+ $rows = array("['Duration', 'Builds']");
+ foreach ($newdata as $duration => $count) {
+ if ($duration == '0 second')
+ $duration = '< 1 minute';
+
$rows[] = sprintf("['%s', %d]", $duration, $count);
}
$rows = implode(', ', $rows);
return <<<S
function draw_buildtime_chart() {
- /*
- {$d}
- */
- var data = google.visualization.arrayToDataTable([{$rows}]);
+ var data = google.visualization.arrayToDataTable([
+ {$rows}
+ ]);
var options = {
- title: 'Builds duration',
- hAxis: {title: ''},
- 'width':600,
- 'height':300
+ title: 'How long are most builds?',
+ hAxis: {title: 'Time'},
+ 'width':500,
+ 'height':200
};
var chart = new google.visualization.ColumnChart(document.getElementById('{$id}'));
chart.draw(data, options);
@@ -320,25 +336,24 @@ S;
public static function js_draw_buildschedule_chart($data, $id)
{
- $d = print_r($data, true);
- $rows = array("['Hour', 'Builds']", '[1, 3]');
+ $rows = array("['Hour', 'Builds']");
foreach ($data as $hour => $count) {
$rows[] = sprintf("['%s', %d]", $hour, $count);
}
$rows = implode(', ', $rows);
return <<<S
function draw_buildschedule_chart() {
- /*
- {$d}
- */
- var data = google.visualization.arrayToDataTable([{$rows}]);
+ var data = google.visualization.arrayToDataTable([
+ {$rows}
+ ]);
var options = {
- title: 'Builds layout',
- hAxis: {title: ''},
- 'width':600,
- 'height':300
+ title: 'When did builds happen? (CET)',
+ hAxis: {title: 'Hours'},
+ 'width':800,
+ 'height':200,
+ 'curveType': 'function'
};
- var chart = new google.visualization.ColumnChart(document.getElementById('{$id}'));
+ var chart = new google.visualization.LineChart(document.getElementById('{$id}'));
chart.draw(data, options);
}
S;