Changeset 61 for trunk/graph.php
- Timestamp:
- Dec 31, 2015, 11:02:23 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/graph.php
r56 r61 3 3 include('global.php'); 4 4 5 if(array_key_exists('Debug', $_GET)) $Debug = $_GET['Debug']; 5 if(array_key_exists('Debug', $_GET)) $Debug = $_GET['Debug']; 6 6 else $Debug = 0; 7 7 … … 14 14 if(!array_key_exists('Measure',$_GET)) die('Musíte zadat měřenou veličinu'); 15 15 $MeasureId = addslashes($_GET['Measure']); 16 if(!array_key_exists('Width', $_GET)) $Width = $DefaultWidth; 16 if(!array_key_exists('Width', $_GET)) $Width = $DefaultWidth; 17 17 else $Width = addslashes($_GET['Width']); 18 18 if(!array_key_exists('Height', $_GET)) $Height = $DefaultHeight; … … 32 32 $Points = GetValues($Measure, $StartTime, $EndTime, $Level); 33 33 34 if($Debug) echo('Points count: '.count($Points).'<br>'); 35 //if($Debug) foreach($Points as $Index => $Item) 34 if($Debug) echo('Points count: '.count($Points).'<br>'); 35 //if($Debug) foreach($Points as $Index => $Item) 36 36 // echo($Index.': '.$Item['min'].'<br>'); 37 37 … … 55 55 $AvgValue = $AvgValue / count($Points); //round(* $Measure['Divider']) / $Measure['Divider']; 56 56 57 // Generate polygon and recalculate y values to fit graph height 57 // Generate polygon and recalculate y values to fit graph height 58 58 $PointsMin = array(0, $Height-1); 59 59 $PointsAvg = array(0, $Height-1); … … 97 97 { 98 98 Header("Content-type: image/png"); 99 Header("Cache-Control: no-cache"); // Dynamic graph - no cache 99 Header("Cache-Control: no-cache"); // Dynamic graph - no cache 100 100 $Image = @imagecreate($Width, $Height); 101 101 $BackgroundColor = imagecolorallocate($Image, 255, 255, 255); … … 122 122 if($TimeMarksIndex < 2) $TimeMarksIndex = 2; 123 123 $MajorTimeMarks = $TimeMarks[$TimeMarksIndex - 1]; 124 $MinorTimeMarks = $TimeMarks[$TimeMarksIndex - 2]; 124 $MinorTimeMarks = $TimeMarks[$TimeMarksIndex - 2]; 125 125 126 $TimeShift = AlignTime($StartTime, $MajorTimeMarks) - $StartTime; 126 $TimeShift = AlignTime($StartTime, $MajorTimeMarks) - $StartTime; 127 127 //imagestring($Image, 10, 40, 50, $TimeShift, $Black); 128 128 … … 134 134 for($X=1; $X < $Width; $X = $X + 3) imagesetpixel($Image, $X, $Y, $Gray); 135 135 //imageline($Image, 30, $Y, $Width-1, $Y, IMG_COLOR_STYLED); 136 } 136 } 137 137 138 $TimeShift = AlignTime($StartTime, $MinorTimeMarks) - $StartTime; 138 $TimeShift = AlignTime($StartTime, $MinorTimeMarks) - $StartTime; 139 139 140 140 // Zobraz měřítko X … … 142 142 for($Time = $StartTime; $Time < $EndTime; $Time += $MajorTimeMarks) 143 143 { 144 $X = round(($Time - $StartTime + $TimeShift) / $TimeRange * $Width) % $Width; 144 $X = round(($Time - $StartTime + $TimeShift) / $TimeRange * $Width) % $Width; 145 145 //imageline($Image, 30, $Y, $Width-1, $Y, IMG_COLOR_STYLED); 146 146 if(($MajorTimeMarks > 60*60*24)) $Text = date('j.n.Y', $Time + $TimeShift);
Note:
See TracChangeset
for help on using the changeset viewer.