Changeset 4 for www/statistic/graf2.php
- Timestamp:
- Jan 14, 2008, 9:48:39 PM (17 years ago)
- Location:
- www
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
www
-
Property svn:ignore
set to
config.php
php_script_error.log
-
Property svn:ignore
set to
-
www/statistic/graf2.php
r1 r4 1 <? 2 include('../db.php'); 3 DB_Init('localhost','root','','statistic'); 1 <?php 2 include('../global.php'); 4 3 include('measures.php'); 4 $Database->select_db('statistic'); 5 5 $Debug = 0; 6 6 $VerticalLinesCount = 12; 7 if(!array_key_exists('count',$_GET)) die('Musíte zadat po èet jednotek');7 if(!array_key_exists('count',$_GET)) die('Musíte zadat počet jednotek'); 8 8 $Pocet = $_GET['count']; 9 9 if(!array_key_exists('size',$_GET)) die('Musíte zadat velikost jednotky'); … … 25 25 26 26 if($Debug ==0) header("Content-type: image/png"); 27 header("Cache-Control: no-cache"); // Dynamický graf neke ±ovat27 header("Cache-Control: no-cache"); // Dynamický graf nekeąovat 28 28 //$string = $_GET['text']; 29 29 $im = @imagecreate($Sirka, $Vyska+14); … … 35 35 $green = imagecolorallocate($im, 100,200,100); 36 36 37 // Zobraz m ìøítko X37 // Zobraz měřítko X 38 38 /* 39 39 if($Pocet>) … … 72 72 //flush(); 73 73 74 // Zji ¹tìní maxima74 // Zjištění maxima 75 75 /* 76 76 DB_Query('SELECT MAX('.$type.') FROM traffic ORDER BY time DESC LIMIT 0,'.$Pocet*$Velikost); … … 92 92 $EndTime = $Ted-$I*60*$Velikost+10; 93 93 $StartTime = $EndTime-60*$Velikost-10; 94 DB_Query('SELECT AVG('.$type.'),MAX('.$type.') FROM traffic WHERE time>FROM_UNIXTIME('.$StartTime.') AND time<FROM_UNIXTIME('.$EndTime.')'); 95 $Row = DB_Row(); 96 if($Max<$Row[1]) $Max = $Row[1]; 97 if($Min>$Row[1]) $Min = $Row[1]; 94 //echo('SELECT AVG('.$type.'),MAX('.$type.') FROM traffic WHERE time>FROM_UNIXTIME('.$StartTime.') AND time<FROM_UNIXTIME('.$EndTime.')'); 95 $DbResult = $Database->query('SELECT AVG('.$type.'),MAX('.$type.') FROM traffic WHERE time>FROM_UNIXTIME('.$StartTime.') AND time<FROM_UNIXTIME('.$EndTime.')'); 96 //if($DbResult->num_rows > 0) 97 //{ 98 $Row = $DbResult->fetch_array(); 99 if($Max < $Row[1]) $Max = $Row[1]; 100 if($Min > $Row[1]) $Min = $Row[1]; 98 101 //print_r($Row); 99 102 //echo($Row[0].' '.$StartTime.'-'.$EndTime.'('.($EndTime-$StartTime).")\n"); 100 $Total = $Row[0] *$nasobek*$Vyska;101 $BodyAVG[] = $Sirka -$x;103 $Total = $Row[0] * $nasobek * $Vyska; 104 $BodyAVG[] = $Sirka - $x; 102 105 $BodyAVG[] = $Total; 103 $Total = $Row[1] *$nasobek*$Vyska;104 $BodyMAX[] = $Sirka -$x;106 $Total = $Row[1] * $nasobek * $Vyska; 107 $BodyMAX[] = $Sirka - $x; 105 108 $BodyMAX[] = $Total; 106 109 //$Total = $Row[2]*$nasobek*$Vyska; … … 108 111 //$BodyMIN[] = $Total; 109 112 $x += $Krok; 110 113 //} 111 114 } 112 115 $Max = floor($Max*$nasobek*1.05); … … 118 121 //echo($Max.' '.$Min.' '.$VerticalLinesDistance); 119 122 120 // Zobraz m ìøítko Y123 // Zobraz měřítko Y 121 124 $PocetY = (floor($Max/$VerticalLinesDistance)); 122 125 for($i=0;$i<=$PocetY;$i++) … … 142 145 // flush(); 143 146 //foreach($BodyMAX) 144 // Pr ùmìrování147 // Průměrování 145 148 /* 146 149 for($i=1;$i<(count($BodyAVG)-8);$i=$i+2)
Note:
See TracChangeset
for help on using the changeset viewer.