Пример #1
0
 public function createPieChart($sdate, $edate)
 {
     $timeEntryObj = new TimeEntry();
     $timeEntries = $timeEntryObj->getProjectWiseReport($sdate, $edate);
     $data = [];
     $cnt = 0;
     $pie = new PieGraph();
     foreach ($timeEntries as $entry) {
         $time_arr[] = $entry->totalTime;
         $pname_arr[] = $entry->projectName;
         $color_arr[] = $pie->random_color();
     }
     $pie->setImage(200, 100, $time_arr);
     // colors for the data
     $color_arr = ["#ff0000", "#ff8800", "#0022ff", "#989898", "#6600CC", "#FF0000 ", "#660066", "#CCFF00", "#FF0099", "#33ff99", "#33ff11"];
     $pie->setColors($color_arr);
     // legends for the data
     $pie->setLegends($pname_arr);
     // Display creation time of the graph
     $pie->DisplayCreationTime();
     // Height of the pie 3d effect
     $pie->set3dHeight(15);
     // Display the graph
     $pie->display();
 }