2008-03-09 17:49:23 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								< ? php  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-09-08 02:57:02 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								ini_set ( 'allow_url_fopen' ,  0 );  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								ini_set ( 'display_errors' ,  0 );  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								if  ( strpos ( $_SERVER [ 'REQUEST_URI' ],  " debug " ))  
						 
					
						
							
								
									
										
										
										
											2011-03-17 11:48:03 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2011-09-08 02:57:02 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  $debug  =  " 1 " ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-23 09:54:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  ini_set ( 'display_errors' ,  1 ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-08 02:57:02 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  ini_set ( 'display_startup_errors' ,  1 ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  ini_set ( 'log_errors' ,  1 ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  ini_set ( 'error_reporting' ,  E_ALL ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  else  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  $debug  =  FALSE ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  ini_set ( 'display_errors' ,  0 ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-23 09:54:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  ini_set ( 'display_startup_errors' ,  0 ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  ini_set ( 'log_errors' ,  0 ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-08 02:57:02 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  ini_set ( 'error_reporting' ,  0 ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2008-03-09 17:49:23 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-02-27 14:44:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								include ( " ../includes/defaults.inc.php " );  
						 
					
						
							
								
									
										
										
										
											2008-03-09 17:49:23 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								include ( " ../config.php " );  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								include ( " ../includes/functions.php " );  
						 
					
						
							
								
									
										
										
										
											2010-07-31 21:08:35 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								include ( " includes/functions.inc.php " );  
						 
					
						
							
								
									
										
										
										
											2010-02-20 17:37:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								include ( " includes/authenticate.inc.php " );  
						 
					
						
							
								
									
										
										
										
											2011-03-17 11:48:03 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								if  ( ! $_SESSION [ 'authenticated' ])  {  echo ( " unauthenticated " );  exit ;  }  
						 
					
						
							
								
									
										
										
										
											2011-09-12 10:53:05 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								require ( " includes/jpgraph/src/jpgraph.php " );  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								include ( " includes/jpgraph/src/jpgraph_line.php " );  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								include ( " includes/jpgraph/src/jpgraph_utils.inc.php " );  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								include ( " includes/jpgraph/src/jpgraph_date.php " );  
						 
					
						
							
								
									
										
										
										
											2008-03-09 17:49:23 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-03-17 11:48:03 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								if  ( is_numeric ( $_GET [ 'bill_id' ]))  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2011-03-23 09:54:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  if  ( bill_permitted ( $_GET [ 'bill_id' ])) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    $bill_id  =  $_GET [ 'bill_id' ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  }  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-17 11:48:03 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    echo ( " Unauthorised Access Prohibited. " ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    exit ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-23 09:54:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  else  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  echo ( " Unauthorised Access Prohibited. " ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  exit ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-03-09 17:49:23 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-03-17 11:48:03 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								$start  =  $_GET [ from ];  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								$end  =  $_GET [ to ];  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								$xsize  =  $_GET [ x ];  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								$ysize  =  $_GET [ y ];  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								$count  =  $_GET [ count ];  
						 
					
						
							
								
									
										
										
										
											2008-03-09 17:49:23 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								$count  =  $count  +  0 ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								$iter  =  1 ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								if  ( $_GET [ type ])  {  $type  =  $_GET [ type ];  }  else  {  $type  =  " date " ;  }  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								$dur  =  $end  -  $start ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-09-08 02:57:02 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								$datefrom  =  date ( 'Ymthis' ,  $start );  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								$dateto  =  date ( 'Ymthis' ,    $end );  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-03-17 11:48:03 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								$rate_data  =  getRates ( $bill_id , $datefrom , $dateto );  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								$rate_95th  =  $rate_data [ 'rate_95th' ]  *  1000 ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								$rate_average  =  $rate_data [ 'rate_average' ]  *  1000 ;  
						 
					
						
							
								
									
										
										
										
											2008-03-09 17:49:23 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-09-08 02:57:02 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								$bi_a  =  dbFetchRow ( " SELECT * FROM bills WHERE bill_id = ? " ,  array ( $bill_id ));  
						 
					
						
							
								
									
										
										
										
											2011-03-17 11:48:03 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								$bill_name  =  $bi_a [ 'bill_name' ];  
						 
					
						
							
								
									
										
										
										
											2008-03-09 17:49:23 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-09-12 10:51:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								$dur  =  $end  -  $start ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								$counttot  =  dbFetchCell ( " SELECT count(`delta`) FROM `bill_data` WHERE `bill_id` = ? AND `timestamp` >= FROM_UNIXTIME( ? ) AND `timestamp` <= FROM_UNIXTIME( ? ) " ,  array ( $bill_id ,  $start ,  $end ));  
						 
					
						
							
								
									
										
										
										
											2008-03-09 17:49:23 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-09-12 10:51:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								$count  =  round ( $dur  /  300  /  (( $ysize  -  100 )  *  3 ),  0 );  
						 
					
						
							
								
									
										
										
										
											2008-03-09 17:49:23 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								if  ( $count  <=  1 )  {  $count  =  2 ;  }  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								#$count = round($counttot / 260, 0);
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								#if ($count <= 1) { $count = 2; }
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-09-12 10:51:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								$max  =  dbFetchCell ( " SELECT delta FROM bill_data WHERE bill_id = ? AND `timestamp` >= FROM_UNIXTIME( ? ) AND `timestamp` <= FROM_UNIXTIME( ? ) ORDER BY delta DESC LIMIT 0,1 " ,  array ( $bill_id ,  $start ,  $end ));  
						 
					
						
							
								
									
										
										
										
											2011-03-17 11:48:03 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								if  ( $max  >  1000000 )  {  $div  =  " 1000000 " ;  $yaxis  =  " Mbit/sec " ;   }  else  {  $div  =  " 1000 " ;  $yaxis  =  " Kbit/sec " ;  }  
						 
					
						
							
								
									
										
										
										
											2008-03-09 17:49:23 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								$i  =  '0' ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-09-12 10:51:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								foreach  ( dbFetch ( " SELECT *, UNIX_TIMESTAMP(timestamp) AS formatted_date FROM bill_data WHERE bill_id = ? AND `timestamp` >= FROM_UNIXTIME( ? ) AND `timestamp` <= FROM_UNIXTIME( ? ) ORDER BY timestamp ASC " ,  array ( $bill_id ,  $start ,  $end ))  as  $row )  
						 
					
						
							
								
									
										
										
										
											2011-03-17 11:48:03 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2011-03-23 09:54:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  @ $timestamp  =  $row [ 'formatted_date' ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  if  ( ! $first )  {  $first  =  $timestamp ;  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  @ $delta  =  $row [ 'delta' ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  @ $period  =  $row [ 'period' ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  @ $in_delta  =  $row [ 'in_delta' ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  @ $out_delta  =  $row [ 'out_delta' ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  @ $in_value  =  round ( $in_delta  *  8  /  $period  /  $div ,  2 ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  @ $out_value  =  round ( $out_delta  *  8  /  $period  /  $div ,  2 ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  @ $last  =  $timestamp ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-09-12 10:51:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  $iter_in       +=  $in_delta ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  $iter_out      +=  $out_delta ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  $iter_period   +=  $period ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-23 09:54:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  if  ( $iter  ==  $count ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    $out_data [ $i ]    =  round ( $iter_out  *  8  /  $iter_period  /  $div ,  2 ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-12 10:51:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    $out_data_inv [ $i ]    =  $out_data [ $i ]  *  - 1 ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-23 09:54:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    $in_data [ $i ]    =  round ( $iter_in  *  8  /  $iter_period  /  $div ,  2 ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    $tot_data [ $i ]    =  $out_data [ $i ]  +  $in_data [ $i ]; 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-12 10:51:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    $tot_data_inv [ $i ]    =  $tot_data [ $i ]  *  - 1 ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-23 09:54:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-09-20 14:37:54 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if  ( $tot_data [ $i ]  >  $max_value )  {  $max_value  =  $tot_data [ $i ];  } 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-17 11:48:03 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-09-12 10:51:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    $ticks [ $i ]       =  $timestamp ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-23 09:54:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    $per_data [ $i ]    =  $rate_95th  /  $div ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    $ave_data [ $i ]    =  $rate_average  /  $div ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    $iter        =  " 1 " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    $i ++ ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    unset ( $iter_out ,  $iter_in ,  $iter_period ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  $iter ++ ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-03-09 17:49:23 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								$graph_name  =  date ( 'M j g:ia' ,  $start )  .  "  -  "  .  date ( 'M j g:ia' ,  $last );  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								$n  =  count ( $ticks );  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								$xmin  =  $ticks [ 0 ];  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								$xmax  =  $ticks [ $n - 1 ];  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								$graph_name  =  date ( 'M j g:ia' ,  $xmin )  .  "  -  "  .  date ( 'M j g:ia' ,  $xmax );  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								$graph  =  new  Graph ( $xsize ,  $ysize ,  $graph_name );  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								$graph -> img -> SetImgFormat ( " png " );  
						 
					
						
							
								
									
										
										
										
											2011-09-12 10:51:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								$graph -> SetScale ( 'datlin' , 0 , 0 , $start , $end );  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-03-17 11:48:03 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								$graph -> title -> Set ( " $graph_name " );  
						 
					
						
							
								
									
										
										
										
											2010-06-21 04:18:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								$graph -> title -> SetFont ( FF_FONT2 , FS_BOLD , 10 );  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								$graph -> xaxis -> SetFont ( FF_FONT1 , FS_BOLD );  
						 
					
						
							
								
									
										
										
										
											2008-03-09 17:49:23 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-09-12 10:51:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								$graph -> xaxis -> SetTextLabelInterval ( 2 );  
						 
					
						
							
								
									
										
										
										
											2008-03-09 17:49:23 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								$graph -> xaxis -> SetPos ( 'min' );  
						 
					
						
							
								
									
										
										
										
											2010-06-21 04:18:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								#$graph->xaxis->SetLabelAngle(15);
  
						 
					
						
							
								
									
										
										
										
											2008-03-09 17:49:23 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								$graph -> yaxis -> HideZeroLabel ( 1 );  
						 
					
						
							
								
									
										
										
										
											2010-06-21 04:18:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								$graph -> yaxis -> SetFont ( FF_FONT1 );  
						 
					
						
							
								
									
										
										
										
											2008-03-09 17:49:23 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								$graph -> yaxis -> SetLabelAngle ( 0 );  
						 
					
						
							
								
									
										
										
										
											2010-06-21 04:18:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								$graph -> xaxis -> title -> SetFont ( FF_FONT1 , FS_NORMAL , 10 );  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								$graph -> yaxis -> title -> SetFont ( FF_FONT1 , FS_NORMAL , 10 );  
						 
					
						
							
								
									
										
										
										
											2008-03-09 17:49:23 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								$graph -> yaxis -> SetTitleMargin ( 50 );  
						 
					
						
							
								
									
										
										
										
											2011-03-17 11:48:03 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								$graph -> xaxis -> SetTitleMargin ( 30 );  
						 
					
						
							
								
									
										
										
										
											2008-03-09 17:49:23 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								#$graph->xaxis->HideLastTickLabel();
  
						 
					
						
							
								
									
										
										
										
											2011-03-17 11:48:03 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								#$graph->xaxis->HideFirstTickLabel();
  
						 
					
						
							
								
									
										
										
										
											2008-03-09 17:49:23 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								#$graph->yaxis->scale->SetAutoMin(1);
  
						 
					
						
							
								
									
										
										
										
											2011-09-12 10:51:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								$graph -> xaxis -> title -> Set ( $type );  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								$graph -> yaxis -> title -> Set ( $yaxis );  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-09-20 09:55:11 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								function  TimeCallback ( $aVal )  {  
						 
					
						
							
								
									
										
										
										
											2011-09-12 10:51:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    global  $dur ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( $dur  <  172800 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      return  Date ( 'H:i' , $aVal ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    }  elseif  ( $dur  <  604800 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      return  Date ( 'D' , $aVal ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    }  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-20 09:55:11 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								      return  Date ( 'j M' , $aVal ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-12 10:51:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2008-03-09 17:49:23 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-09-12 10:51:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								$graph -> xaxis -> SetLabelFormatCallback ( 'TimeCallBack' );  
						 
					
						
							
								
									
										
										
										
											2008-03-09 17:49:23 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								$graph -> ygrid -> SetFill ( true , '#EFEFEF@0.5' , '#FFFFFF@0.5' );  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								$graph -> xgrid -> Show ( true , true );  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								$graph -> xgrid -> SetColor ( '#e0e0e0' , '#efefef' );  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								$graph -> SetMarginColor ( 'white' );  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								$graph -> SetFrame ( false );  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								$graph -> SetMargin ( 75 , 30 , 30 , 45 );  
						 
					
						
							
								
									
										
										
										
											2010-06-21 04:18:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								$graph -> legend -> SetFont ( FF_FONT1 , FS_NORMAL );  
						 
					
						
							
								
									
										
										
										
											2008-03-09 17:49:23 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-09-12 10:51:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								$lineplot  =  new  LinePlot ( $tot_data ,  $ticks );  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								$lineplot -> SetLegend ( " Traffic total " );  
						 
					
						
							
								
									
										
										
										
											2008-03-09 17:49:23 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								$lineplot -> SetColor ( " #d5d5d5 " );  
						 
					
						
							
								
									
										
										
										
											2011-09-12 10:51:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								$lineplot -> SetFillColor ( " #d5d5d5@0.5 " );  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								#$lineplot2 = new LinePlot($tot_data_inv, $ticks);
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								#$lineplot2->SetColor("#d5d5d5");
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								#$lineplot2->SetFillColor("#d5d5d5@0.5");
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								$lineplot_in  =  new  LinePlot ( $in_data ,  $ticks );  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								$lineplot_in -> SetLegend ( " Traffic In " );  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								$lineplot_in -> SetColor ( 'darkgreen' );  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								$lineplot_in -> SetFillColor ( 'lightgreen@0.4' );  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								$lineplot_in -> SetWeight ( 1 );  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								$lineplot_out  =  new  LinePlot ( $out_data_inv ,  $ticks );  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								$lineplot_out -> SetLegend ( " Traffic Out " );  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								$lineplot_out -> SetColor ( 'darkblue' );  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								$lineplot_out -> SetFillColor ( 'lightblue@0.4' );  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								$lineplot_out -> SetWeight ( 1 );  
						 
					
						
							
								
									
										
										
										
											2008-03-09 17:49:23 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-03-17 11:48:03 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								if  ( $_GET [ '95th' ])  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2011-09-12 10:51:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  $lineplot_95th  =  new  LinePlot ( $per_data ,  $ticks ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-23 09:54:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  $lineplot_95th  -> SetColor ( " red " ); 
							 
						 
					
						
							
								
									
										
										
										
											2008-03-09 17:49:23 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-03-17 11:48:03 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								if  ( $_GET [ 'ave' ])  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2011-09-12 10:51:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  $lineplot_ave  =  new  LinePlot ( $ave_data ,  $ticks ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-23 09:54:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  $lineplot_ave  -> SetColor ( " red " ); 
							 
						 
					
						
							
								
									
										
										
										
											2008-03-09 17:49:23 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-09-12 10:51:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								$graph -> legend -> SetLayout ( LEGEND_HOR );  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								$graph -> legend -> Pos ( 0.52 ,  0.90 ,  'center' );  
						 
					
						
							
								
									
										
										
										
											2008-03-09 17:49:23 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								$graph -> Add ( $lineplot );  
						 
					
						
							
								
									
										
										
										
											2011-09-12 10:51:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								#$graph->Add($lineplot2);
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-03-09 17:49:23 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								$graph -> Add ( $lineplot_in );  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								$graph -> Add ( $lineplot_out );  
						 
					
						
							
								
									
										
										
										
											2011-03-17 11:48:03 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								if  ( $_GET [ '95th' ])  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2011-03-23 09:54:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  $graph -> Add ( $lineplot_95th ); 
							 
						 
					
						
							
								
									
										
										
										
											2008-03-09 17:49:23 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2011-03-17 11:48:03 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								if  ( $_GET [ 'ave' ])  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2011-03-23 09:54:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  $graph -> Add ( $lineplot_ave ); 
							 
						 
					
						
							
								
									
										
										
										
											2008-03-09 17:49:23 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								$graph -> stroke ();  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-03-22 20:27:39 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								?>