summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain d'Alverny <rda@mageia.org>2012-09-04 16:39:27 +0000
committerRomain d'Alverny <rda@mageia.org>2012-09-04 16:39:27 +0000
commit7e0eaf6c7ce99b02d2a73b68d687a20d8a547c6f (patch)
tree1b749723bc358a4cebfb2a4a7a368fcedd658d4d
parentfec4435bf491d058bb7d71a6493bb23c4407133d (diff)
downloadpkgsubmit-7e0eaf6c7ce99b02d2a73b68d687a20d8a547c6f.tar
pkgsubmit-7e0eaf6c7ce99b02d2a73b68d687a20d8a547c6f.tar.gz
pkgsubmit-7e0eaf6c7ce99b02d2a73b68d687a20d8a547c6f.tar.bz2
pkgsubmit-7e0eaf6c7ce99b02d2a73b68d687a20d8a547c6f.tar.xz
pkgsubmit-7e0eaf6c7ce99b02d2a73b68d687a20d8a547c6f.zip
add packagers piechart
-rw-r--r--lib.php30
-rw-r--r--test_index.php4
2 files changed, 33 insertions, 1 deletions
diff --git a/lib.php b/lib.php
index b00244e..24eda84 100644
--- a/lib.php
+++ b/lib.php
@@ -263,6 +263,7 @@ function drawChart() {
draw_status_chart();
draw_buildtime_chart();
draw_buildschedule_chart();
+ draw_packagers_chart();
}
S;
}
@@ -296,6 +297,35 @@ S;
return $s;
}
+ public static function js_draw_packagers_chart($data, $id)
+ {
+ $rows = array();
+ foreach ($data as $packager => $count) {
+ $rows[] = sprintf("['%s', %d]", $packager, $count);
+ }
+ $rows = implode(', ', $rows);
+ $s = <<<S
+function draw_packagers_chart() {
+ var data = new google.visualization.DataTable();
+ data.addColumn('string', 'Packagers');
+ data.addColumn('number', 'Packages');
+ data.addRows([{$rows}]);
+
+ var options = {
+ 'title':'Packagers',
+ 'width':600,
+ 'height':200,
+ 'backgroundColor': '#f8f8f8',
+ 'sliceVisibilityThreshold': 1/720
+ };
+
+ var chart = new google.visualization.PieChart(document.getElementById('{$id}'));
+ chart.draw(data, options);
+}
+S;
+ return $s;
+ }
+
public static function js_draw_buildtime_chart($data, $id)
{
// first pass
diff --git a/test_index.php b/test_index.php
index 77d6309..64d2055 100644
--- a/test_index.php
+++ b/test_index.php
@@ -344,7 +344,8 @@ if ($total > 0) {
// Stats
$s = '<div id="stats">
- <div id="status-chart"></div>';
+ <div id="status-chart"></div>
+ <div id="packagers-chart"></div>';
// Packagers stats
$s .= '<table style="width: 70%; margin: 2em 0 2em 80px;"><caption>Packagers</caption><tr><th>User</th><th>Packages</th></tr>';
@@ -384,6 +385,7 @@ else
mga_bs_charts::js_draw_status_chart($stats, 'status-chart'),
mga_bs_charts::js_draw_buildtime_chart($buildtime_stats, 'buildtime-chart'),
mga_bs_charts::js_draw_buildschedule_chart($build_dates, 'buildschedule-chart'),
+ mga_bs_charts::js_draw_packagers_chart(users, 'packagers-chart'),
mga_bs_charts::js_draw_charts(),
'</script>';
echo mga_bs_charts::js_init();