Legend:
- Unmodified
- Added
- Removed
-
graph.php
r3 r6 5 5 else $Debug = 0; 6 6 7 $DefaultWidth = 750;8 $DefaultHeight = 200;9 $K = 0.9; // Coeficient for decreasing graph height10 $FontFile = 'arial.ttf';11 $FontSize = 10;12 13 7 if(!array_key_exists('From',$_GET)) die('Musíte zadat èas poèátku'); 14 8 $StartTime = addslashes($_GET['From']); … … 47 41 foreach($Points as $Index => $Item) 48 42 { 49 $Points[$Index]['min'] = $Points[$Index]['min'] / $Measure[' display_divider'];50 $Points[$Index]['avg'] = $Points[$Index]['avg'] / $Measure[' display_divider'];51 $Points[$Index]['max'] = $Points[$Index]['max'] / $Measure[' display_divider'];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']; 52 46 if($Points[$Index]['avg'] > $MaxValue) $MaxValue = $Points[$Index]['avg']; 53 47 if($Points[$Index]['avg'] < $MinValue) $MinValue = $Points[$Index]['avg']; … … 56 50 $AvgValue = $AvgValue + $Points[$Index]['avg']; 57 51 } 58 $MinValue = round($MinValue * $Measure[' display_divider']) / $Measure['display_divider'];59 $MaxValue = round($MaxValue * $Measure[' display_divider']) / $Measure['display_divider'];60 $AvgValue = round($AvgValue / count($Points) * $Measure[' display_divider']) / $Measure['display_divider'];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']; 61 55 62 56 // Generate polygon and recalculate y values to fit graph height … … 91 85 92 86 93 array_unshift($Points, $Height - 1); 94 array_unshift($Points, 0); 95 $Points[] = $Width - 1; 96 $Points[] = $Height - 1; 87 //array_unshift($Points, $Height - 1); 88 //array_unshift($Points, 0); 89 //$Points[] = $Width - 1; 90 //$Points[] = $Height - 1; 91 92 //print_r($PointsMax); 97 93 98 94 // Generate image … … 182 178 $GenerationTime = floor((GetMicrotime() - $StopWatchStart) * 1000 ) / 1000; 183 179 184 imagettftext($Image, $FontSize, 0, $Width-94, 14, $Red, $FontFile, "Max. ".$MaxValue.' '.$Measure[' unit']);185 imagettftext($Image, $FontSize, 0, $Width-194, 14, $Green, $FontFile, "Avg. ".$AvgValue.' '.$Measure[' unit']);186 imagettftext($Image, $FontSize, 0, $Width-294, 14, $Blue, $FontFile, "Min. ".$MinValue.' '.$Measure[' unit']);180 imagettftext($Image, $FontSize, 0, $Width-94, 14, $Red, $FontFile, "Max. ".$MaxValue.' '.$Measure['Unit']); 181 imagettftext($Image, $FontSize, 0, $Width-194, 14, $Green, $FontFile, "Avg. ".$AvgValue.' '.$Measure['Unit']); 182 imagettftext($Image, $FontSize, 0, $Width-294, 14, $Blue, $FontFile, "Min. ".$MinValue.' '.$Measure['Unit']); 187 183 imagestring($Image, 2, 50, 20, 'Vygenerováno za '.$GenerationTime.' sekund', $Black); 188 184 //imagestring($Image, 2, 50, 30, 'Level: '.$Level, $Black); 189 185 190 imagettftext($Image, $FontSize, 0, 50, 14, $Black, $FontFile, to_utf8($Measure[' description']));186 imagettftext($Image, $FontSize, 0, 50, 14, $Black, $FontFile, to_utf8($Measure['Description'])); 191 187 imagerectangle($Image, 0, 0, $Width - 1, $Height - 1, $Black); // Frame border 192 188 imagepng($Image);
Note:
See TracChangeset
for help on using the changeset viewer.