diff options
-rw-r--r-- | lib.php | 30 | ||||
-rw-r--r-- | test_index.php | 4 |
2 files changed, 33 insertions, 1 deletions
@@ -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(); |