2 require_once('env.inc.php');
3 require_once('pre.php');
4 require_once('preplugins.php');
6 require_once($GLOBALS['jpgraph_dir'].'/jpgraph.php');
7 require_once($GLOBALS['jpgraph_dir'].'/jpgraph_pie.php');
9 $pass_count = $request->get('p');
10 $fail_count = $request->get('f');
11 $skip_count = $request->get('s');
12 $total_count = $pass_count + $fail_count + $skip_count;
15 $graph = new PieGraph(250,150);
18 $graph->title-> Set(_("Test Results"));
21 $pass_legend = vsprintf(_("Pass (%s)"), array($pass_count));
22 $fail_legend = vsprintf(_("Fail (%s)"), array($fail_count));
23 $skip_legend = vsprintf(_("Skip (%s)"), array($skip_count));
25 $array_legend = array($pass_legend, $fail_legend);
26 $array_value = array($pass_count, $fail_count);
27 $array_color = array('blue', 'red');
28 if ($skip_count != 0) {
29 $array_legend[] = $skip_legend;
30 $array_value[] = $skip_count;
31 $array_color[] = 'black';
34 // Init pie chart with graph values
35 $pp = new PiePlot($array_value);
38 $pp->SetLegends($array_legend);
40 // pie chart color values
41 // Pass is blue and Failed is red (Skip is black)
42 $pp->SetSliceColors($array_color);
45 // the pie chart is a little bit on the left (0.35) and at the bottom (0.60)
46 $pp->SetCenter(0.35, 0.60);