Legend:
- Unmodified
- Added
- Removed
-
graph.php
r23 r28 5 5 else $Debug = 0; 6 6 7 if(!array_key_exists('From',$_GET)) die('Musíte zadat èas poèátku');7 if(!array_key_exists('From',$_GET)) die('Musíte zadat čas počátku'); 8 8 $StartTime = addslashes($_GET['From']); 9 if(!array_key_exists('To',$_GET)) die('Musíte zadat èas konce');9 if(!array_key_exists('To',$_GET)) die('Musíte zadat čas konce'); 10 10 $EndTime = addslashes($_GET['To']); 11 11 if($EndTime < $StartTime) $EndTime = $StartTime + 60; 12 12 $TimeDifference = $EndTime - $StartTime; 13 if(!array_key_exists('Measure',$_GET)) die('Musíte zadat m ìøenou velièinu');13 if(!array_key_exists('Measure',$_GET)) die('Musíte zadat měřenou veličinu'); 14 14 $MeasureId = addslashes($_GET['Measure']); 15 15 if(!array_key_exists('Width', $_GET)) $Width = $DefaultWidth; … … 17 17 if(!array_key_exists('Height', $_GET)) $Height = $DefaultHeight; 18 18 else $Height = addslashes($_GET['Height']); 19 if(!array_key_exists('Differential', $_GET)) $Differential = $Config['DefaultVariables']['Differential']; 20 else $Differential = addslashes($_GET['Differential']); 19 21 $VerticalLinesCount = round($Height / ($FontSize + 4)); 20 22 … … 41 43 foreach($Points as $Index => $Item) 42 44 { 43 $Points[$Index]['min'] = $Points[$Index]['min'] / $Measure['Divider'];44 $Points[$Index]['avg'] = $Points[$Index]['avg'] / $Measure['Divider'];45 $Points[$Index]['max'] = $Points[$Index]['max'] / $Measure['Divider'];45 //$Points[$Index]['min'] = $Points[$Index]['min'] / $Measure['Divider']; 46 //$Points[$Index]['avg'] = $Points[$Index]['avg'] / $Measure['Divider']; 47 //$Points[$Index]['max'] = $Points[$Index]['max'] / $Measure['Divider']; 46 48 if($Points[$Index]['avg'] > $MaxValue) $MaxValue = $Points[$Index]['avg']; 47 49 if($Points[$Index]['avg'] < $MinValue) $MinValue = $Points[$Index]['avg']; … … 50 52 $AvgValue = $AvgValue + $Points[$Index]['avg']; 51 53 } 52 $MinValue = round($MinValue * $Measure['Divider']) / $Measure['Divider'];53 $MaxValue = round($MaxValue * $Measure['Divider']) / $Measure['Divider'];54 $AvgValue = round($AvgValue / count($Points)* $Measure['Divider']) / $Measure['Divider'];54 //$MinValue = round($MinValue * $Measure['Divider']) / $Measure['Divider']; 55 //$MaxValue = round($MaxValue * $Measure['Divider']) / $Measure['Divider']; 56 $AvgValue = $AvgValue / count($Points); //round( * $Measure['Divider']) / $Measure['Divider']; 55 57 56 58 // Generate polygon and recalculate y values to fit graph height … … 126 128 //imagestring($Image, 10, 40, 50, $TimeShift, $Black); 127 129 128 // Zobraz m ìøítko Y130 // Zobraz měřítko Y 129 131 $VerticalLinesDistance = $Height / $VerticalLinesCount; 130 132 for($I=1; $I<=$VerticalLinesCount; $I++) … … 136 138 137 139 $TimeShift = AlignTime($StartTime, $MinorTimeMarks) - $StartTime; 138 139 /* 140 if(($MinorTimeMarks / $TimeRange * $Width) > 3) 141 for($Time = $StartTime; $Time < $EndTime; $Time += $MinorTimeMarks) 142 { 143 $X = round(($Time - $StartTime + $TimeShift) / $TimeRange * $Width) % $Width; 144 for($Y=0; $Y < $Height; $Y = $Y + 3) imagesetpixel($Image, $X, $Y, $Gray); 145 //imageline($Image, 30, $Y, $Width-1, $Y, IMG_COLOR_STYLED); 146 //imagestring($Image, 2, 2, $Y - 6, round(($I * $VerticalLinesDistance + $MinValue)*$Measure['divider']) / $Measure['divider'], $Black); 147 } 148 */ 149 150 // Zobraz mìøítko X 140 141 // Zobraz měřítko X 151 142 $LastTextEnd = 0; 152 143 for($Time = $StartTime; $Time < $EndTime; $Time += $MajorTimeMarks) … … 178 169 $GenerationTime = floor((GetMicrotime() - $StopWatchStart) * 1000 ) / 1000; 179 170 180 imagettftext($Image, $FontSize, 0, $Width-94, 14, $Red, $FontFile, "Max. ".AddPrefixMultipliers($MaxValue, $Measure['Unit'])); 181 imagettftext($Image, $FontSize, 0, $Width-194, 14, $Green, $FontFile, "Avg. ".AddPrefixMultipliers($AvgValue, $Measure['Unit'])); 182 imagettftext($Image, $FontSize, 0, $Width-294, 14, $Blue, $FontFile, "Min. ".AddPrefixMultipliers($MinValue, $Measure['Unit'])); 171 $Left = $Width - 10; 172 $Text = " Max. ".AddPrefixMultipliers($MaxValue, $Measure['Unit']); 173 $BoundingBox = imagettfbbox($FontSize, 0, $FontFile, $Text); 174 $Left -= ($BoundingBox[2] - $BoundingBox[0]); 175 imagettftext($Image, $FontSize, 0, $Left, 14, $Red, $FontFile, $Text); 176 177 $Text = " Avg. ".AddPrefixMultipliers($AvgValue, $Measure['Unit']); 178 $BoundingBox = imagettfbbox($FontSize, 0, $FontFile, $Text); 179 $Left -= ($BoundingBox[2] - $BoundingBox[0]); 180 imagettftext($Image, $FontSize, 0, $Left, 14, $Green, $FontFile, $Text); 181 182 $Text = " Min. ".AddPrefixMultipliers($MinValue, $Measure['Unit']); 183 $BoundingBox = imagettfbbox($FontSize, 0, $FontFile, $Text); 184 $Left -= ($BoundingBox[2] - $BoundingBox[0]); 185 imagettftext($Image, $FontSize, 0, $Left, 14, $Blue, $FontFile, $Text); 183 186 //imagestring($Image, 2, 70, 20, 'Vygenerováno za '.$GenerationTime.' sekund', $Black); 184 187 //imagestring($Image, 2, 50, 30, 'Level: '.$Level, $Black); 185 188 186 imagettftext($Image, $FontSize, 0, 70, 14, $Black, $FontFile, to_utf8($Measure['Description']));189 imagettftext($Image, $FontSize, 0, 70, 14, $Black, $FontFile, $Measure['Description']); 187 190 imagerectangle($Image, 0, 0, $Width - 1, $Height - 1, $Black); // Frame border 188 191 imagepng($Image);
Note:
See TracChangeset
for help on using the changeset viewer.