3 $sys_path_to_jpgraph='/usr/share/jpgraph';
5 require_once($sys_path_to_jpgraph.'/jpgraph.php');
6 require_once($sys_path_to_jpgraph.'/jpgraph_pie.php');
7 require_once($sys_path_to_jpgraph.'/jpgraph_pie3d.php');
9 function util_unconvert_htmlspecialchars($string) {
10 if (strlen($string) < 1) {
13 //$trans = get_html_translation_table(HTMLENTITIES, ENT_QUOTES);
14 $trans = get_html_translation_table(HTML_ENTITIES);
15 $trans = array_flip ($trans);
16 $str = strtr ($string, $trans);
21 function report_pie_arr($labels, $vals, $format=1) {
22 global $pie_labels,$pie_vals;
23 //first get sum of all values
24 for ($i=0; $i<count($vals); $i++) {
28 //now prune out vals where < 2%
32 for ($i=0; $i<count($vals); $i++) {
33 if (($vals[$i]/$total) < .02) {
36 $pie_labels[]=utf8_decode(util_unconvert_htmlspecialchars($labels[$i]))." (". number_format($vals[$i],$format) .") ".number_format($vals[$i]/$total*100,1)."%%";
37 //$pie_vals[]=number_format($vals[$i],1);
38 $pie_vals[]=$vals[$i];
42 $pie_labels[]=_('Other')." (". number_format($rem,$format) .") ";
43 //$pie_vals[]=number_format($rem,1);
51 $vals = array(2236,1029,687,623,577,466,302,221,205,188,1009);
52 $labels=array("Jean","Paul","Pierre","Philippe","Aimé","Amédé","Noémi","Noël","Philibert","Alphonse","Autres");
54 // Create the graph. These two calls are always required
55 $graph = new PieGraph(640, 480,"auto");
56 //$graph->SetMargin(50,10,35,50);
57 setlocale(LC_TIME, "fr_FR.UTF-8");
58 //setlocale(LC_TIME, "C");
59 setlocale(LC_ALL, "fr_FR.UTF-8");
60 $start=strtotime("12/28/2002");
61 $end=strtotime("6/30/2004");
63 //$graph->title->Set(_("Commits By User")." (".date('m/d/Y',$start) ."-". date('m/d/Y',$end) .")");
64 $graph->title->Set(utf8_decode(_("Commits By User")." (".strftime('%x',$start) ." - ". strftime('%x',$end) .")"));
65 $graph->subtitle->Set(fusionforge_get_config ('forge_name'));
67 // Create the tracker open plot
68 ////report_pie_arr(util_result_column_to_array($res,0), util_result_column_to_array($res,1));
70 //$pie_labels=$labels;
71 report_pie_arr($labels, $vals,0);
74 //print_r($pie_labels);
76 $p1 = new PiePlot3D($pie_vals);
77 $p1->ExplodeSlice (0);
78 $p1->SetLegends($pie_labels);