Example #1
0
 public function executeChartOffices()
 {
     $data = array();
     foreach (OfficePeer::doSelect(new Criteria()) as $office) {
         $c = new Criteria();
         $c->add(ClientServicePeer::OFFICE_ID, $office->getId());
         $data[$office->getName()] = ClientServicePeer::doCount(ClientServicePeer::addActive($c));
     }
     //Creating a stGraph object
     $g = new stGraph();
     //set background color
     $g->bg_colour = '#FFFFFF';
     //Set the transparency, line colour to separate each slice etc.
     $g->pie(90, '#78B9EC', '{font-size: 12px; color: #000000;');
     //array two arrray one containing data while other contaning labels
     $g->pie_values($data, array_keys($data));
     //Set the colour for each slice. Here we are defining three colours
     //while we need 7 colours. So, the same colours will be
     //repeated for the all remaining slices in the same order
     $g->pie_slice_colours(array('#d01f3c', '#356aa0', '#c79810'));
     //To display value as tool tip
     $g->set_tool_tip('#val# Services');
     $g->title('Active Client Services At Location', '{font-size:18px;margin-bottom:20px}');
     echo $g->render();
     return sfView::NONE;
 }