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