Exemplo n.º 1
0
 /**
  * Pilots::create_line_graph()
  * 
  * @param mixed $title
  * @param mixed $data
  * @return
  */
 protected function create_line_graph($title, $data)
 {
     if (!$data) {
         $data = array();
     }
     $bar_values = array();
     $bar_titles = array();
     foreach ($data as $val) {
         $bar_titles[] = $val->ym;
         $bar_values[] = floatval($val->total);
     }
     OFCharts::add_data_set($bar_titles, $bar_values);
     echo OFCharts::create_area_graph($title);
 }
Exemplo n.º 2
0
 public function viewmonthchart()
 {
     $params = $this->formfilter();
     /**
      * Check the first letter in the type
      * m#### - month
      * y#### - year
      * 
      * No type indicates to view the 'overall'
      */
     $type = $this->get->type;
     if ($type[0] == 'y') {
         $type = str_replace('y', '', $type);
         $year = date('Y', $type);
         $finance_data = $this->getyearly($year);
         $title = 'Activity for ' . $year;
     } else {
         // This should be the last 3 months overview
         # Get the last 3 months
         $months = 3;
         $params['p.accepted'] = PIREP_ACCEPTED;
         $finance_data = PIREPData::getIntervalDataByMonth($params, $months);
         $title = 'Recent Activity';
     }
     $titles = array();
     $gross_data = array();
     $fuel_data = array();
     $expense_data = array();
     foreach ($finance_data as $month) {
         $titles[] = $month->ym;
         $gross_data[] = intval($month->revenue);
         $fuel_data[] = intval($month->fuelprice);
         $expense_data[] = intval($month->expenses_total);
     }
     // Add each set
     OFCharts::add_data_set($titles, $gross_data, 'Total Revenue', '#FF6633');
     OFCharts::add_data_set($titles, $expense_data, 'Expenses', '#2EB800');
     OFCharts::add_data_set($titles, $fuel_data, 'Fuel Costs', '#008AB8');
     //echo OFCharts::create_line_graph('Months Balance Data');
     echo OFCharts::create_area_graph($title);
 }