summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Petazzoni <thomas.petazzoni@free-electrons.com>2013-05-12 15:59:16 (GMT)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>2013-05-12 15:59:16 (GMT)
commit457d4cd987b8be98fca519a8d391a7f5b12f9a9d (patch)
treeefad3113d3317f4320fa125222aacf3a802a0da4
parentbb82dfe6366febe6d770fa147c2e9f52e480bac7 (diff)
downloadbuildroot-test-457d4cd987b8be98fca519a8d391a7f5b12f9a9d.tar.gz
buildroot-test-457d4cd987b8be98fca519a8d391a7f5b12f9a9d.tar.bz2
Add a graph of the last 30 days build results
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
-rw-r--r--web/graph.php62
1 files changed, 62 insertions, 0 deletions
diff --git a/web/graph.php b/web/graph.php
new file mode 100644
index 0000000..c37bc88
--- /dev/null
+++ b/web/graph.php
@@ -0,0 +1,62 @@
+<?php
+include("../externals/pchart/class/pDraw.class.php");
+include("../externals/pchart/class/pImage.class.php");
+include("../externals/pchart/class/pData.class.php");
+
+include("funcs.inc.php");
+
+$myData = new pData();
+
+$db = new db();
+
+$sql = "select * from (select sum(status=0) as success,sum(status=1) as failures,sum(status=2) as timeouts,count(*) as total,date(builddate) as day from results group by date(builddate) order by builddate desc limit 30) as foo order by day;";
+
+$ret = $db->query($sql);
+if ($ret == FALSE) {
+ echo "Cannot retrieve statistics<br/>";
+ bab_footer();
+ exit;
+}
+
+$dates_data = array();
+$success_data = array();
+$failures_data = array();
+$timeouts_data = array();
+$total_data = array();
+
+while($current = mysql_fetch_object($ret)) {
+ array_push($dates_data, $current->day);
+ array_push($success_data, $current->success);
+ array_push($failures_data, $current->failures);
+ array_push($timeouts_data, $current->timeouts);
+ array_push($total_data, $current->total);
+}
+
+/* Add data in your dataset */
+$myData->addPoints($success_data, "success");
+$myData->addPoints($failures_data, "failure");
+$myData->addPoints($timeouts_data, "timeout");
+$myData->addPoints($total_data, "total");
+$myData->setAxisName(0,"Number of builds");
+
+$myData->addPoints($dates_data, "Labels");
+$myData->setSerieDescription("Labels","Dates");
+$myData->setAbscissa("Labels");
+
+/* Create a pChart object and associate your dataset */
+$myPicture = new pImage(700,500,$myData);
+
+/* Choose a nice font */
+$myPicture->setFontProperties(array("FontName"=>"../externals/pchart/fonts/verdana.ttf","FontSize"=>8));
+
+/* Define the boundaries of the graph area */
+$myPicture->setGraphArea(70,50,650,400);
+
+$myPicture->drawScale(array("LabelRotation" => 90));
+
+$myPicture->drawLegend(20,20,array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_HORIZONTAL));
+
+$myPicture->drawLineChart();
+
+$myPicture->Stroke();
+?> \ No newline at end of file