コード例 #1
0
ファイル: Dashboard.php プロジェクト: phpmods/phpvms_5.5.x
 public function pirepcounts()
 {
     # Create the chart
     //$reportcounts = '';
     $data = PIREPData::getIntervalDataByDays(array(), 30);
     if (!$data) {
         $data = array();
         // so it doesn't error out
     }
     $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_line_graph('Past 30 days PIREPS');
 }
コード例 #2
0
ファイル: Pilots.php プロジェクト: Galihom/phpVMS
 /**
  * Pilots::statsdaysdata()
  * 
  * @param mixed $pilotid
  * @return
  */
 public function statsdaysdata($pilotid)
 {
     $data = PIREPData::getIntervalDataByDays(array('p.pilotid' => $pilotid), 30);
     $this->create_line_graph('Past 30 days PIREPs', $data);
 }
コード例 #3
0
 public static function build_pireptable($pilotid, $days = '30', $color = '000000', $background = 'EFEFEF', $width = '950', $height = '260')
 {
     #make sure $days is even - if not add 1
     if ($days & 1) {
         $days++;
     }
     $output = array();
     #set current date
     $month = date("m");
     $day = date("d");
     $year = date("Y");
     #set todays date
     $output[] = date('m-d', mktime(0, 0, 0, $month, $day, $year));
     #loop through days
     for ($i = 1; $i <= $days - 1; $i++) {
         $output[] = date('m-d', mktime(0, 0, 0, $month, $day - $i, $year));
     }
     #reverse the days for chart
     $output = array_reverse($output);
     #set baseline values
     $labels = array();
     $points = array();
     $xTotal = 0;
     $yTotal = 0;
     $dataPoint = array();
     $data = PIREPData::getIntervalDataByDays(array('p.pilotid' => $pilotid), $days);
     if ($data) {
         foreach ($data as $dat) {
             $points[] = $dat->total;
             #get highest y-axis value for chart
             if ($dat->total > $total) {
                 $yTotal = $dat->total;
             }
             $date = '';
             $date = explode('-', $dat->ym);
             $labels[] = $date[1] . '-' . $date[2];
             $xTotal++;
             $z = new stdClass();
             $z->label = $date[1] . '-' . $date[2];
             $z->point = $dat->total;
             $dataPoint[] = $z;
         }
     }
     $fLabels = array();
     $fPoints = array();
     $arraySpot = '0';
     foreach ($output as $num => $point) {
         #display every x-axis label on charts 10 days or less
         if ($days < 11) {
             if (in_array($point, $labels)) {
                 $fLabels[] = $dataPoint[$arraySpot]->label;
                 $fPoints[] = $dataPoint[$arraySpot]->point;
                 $arraySpot++;
             } else {
                 $fLabels[] = $point;
                 $fPoints[] = '0';
             }
         } else {
             if (in_array($point, $labels)) {
                 if ($num & 1) {
                     $fLabels[] = $dataPoint[$arraySpot]->label;
                 } else {
                     $fLabels[] = '';
                 }
                 $fPoints[] = $dataPoint[$arraySpot]->point;
                 $arraySpot++;
             } else {
                 if ($num & 1) {
                     $fLabels[] = $point;
                 } else {
                     $fLabels[] = '';
                 }
                 $fPoints[] = '0';
             }
         }
     }
     #build chart params
     $lineChart = new gLineChart($width, $height);
     $lineChart->addDataSet($fPoints);
     $lineChart->setColors(array($color));
     $lineChart->setVisibleAxes(array('x', 'y'));
     $lineChart->setDataRange(0, $yTotal + 1);
     $lineChart->addAxisRange(0, 1, $days, 1);
     $lineChart->addAxisRange(1, 0, $yTotal + 1, 1);
     $lineChart->setlineMarkers('6');
     $lineChart->setlineWidth('1');
     $lineChart->setaxisStyle('0', $color, '10');
     $lineChart->addAxisLabel(0, $fLabels);
     $lineChart->setGridLines(100 / 29, 100 / ($yTotal + 1), 4, 2, 0, 0);
     $lineChart->setTitle("Last " . $days . " Days PIREPS");
     $lineChart->setTitleOptions($color, '18');
     $lineChart->setChartMargins(array(20, 20, 20, 20));
     $lineChart->addBackgroundFill('bg', $background);
     return $lineChart->getUrl();
 }
コード例 #4
0
ファイル: Schedules.php プロジェクト: rallin/phpVMS
 public function statsdaysdata($routeid)
 {
     $routeinfo = SchedulesData::findSchedules(array('s.id' => $routeid));
     $routeinfo = $routeinfo[0];
     // Last 30 days stats
     $data = PIREPData::getIntervalDataByDays(array('p.code' => $routeinfo->code, 'p.flightnum' => $routeinfo->flightnum), 30);
     $this->create_line_graph('Schedule Flown Counts', $data);
 }