Changeset 61 for trunk/graph.php


Ignore:
Timestamp:
Dec 31, 2015, 11:02:23 PM (8 years ago)
Author:
chronos
Message:
  • Added: Used ErrorHandler class Common package.
  • Removed: Unused files.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/graph.php

    r56 r61  
    33include('global.php');
    44
    5 if(array_key_exists('Debug', $_GET)) $Debug = $_GET['Debug']; 
     5if(array_key_exists('Debug', $_GET)) $Debug = $_GET['Debug'];
    66  else $Debug = 0;
    77
     
    1414if(!array_key_exists('Measure',$_GET)) die('Musíte zadat měřenou veličinu');
    1515$MeasureId = addslashes($_GET['Measure']);
    16 if(!array_key_exists('Width', $_GET)) $Width = $DefaultWidth; 
     16if(!array_key_exists('Width', $_GET)) $Width = $DefaultWidth;
    1717else $Width = addslashes($_GET['Width']);
    1818if(!array_key_exists('Height', $_GET)) $Height = $DefaultHeight;
     
    3232$Points = GetValues($Measure, $StartTime, $EndTime, $Level);
    3333
    34 if($Debug) echo('Points count: '.count($Points).'<br>'); 
    35 //if($Debug) foreach($Points as $Index => $Item) 
     34if($Debug) echo('Points count: '.count($Points).'<br>');
     35//if($Debug) foreach($Points as $Index => $Item)
    3636//  echo($Index.': '.$Item['min'].'<br>');
    3737
     
    5555$AvgValue = $AvgValue / count($Points); //round(* $Measure['Divider']) / $Measure['Divider'];
    5656
    57 // Generate polygon and recalculate y values to fit graph height 
     57// Generate polygon and recalculate y values to fit graph height
    5858$PointsMin = array(0, $Height-1);
    5959$PointsAvg = array(0, $Height-1);
     
    9797{
    9898  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
    100100  $Image = @imagecreate($Width, $Height);
    101101  $BackgroundColor = imagecolorallocate($Image, 255, 255, 255);
     
    122122  if($TimeMarksIndex < 2) $TimeMarksIndex = 2;
    123123  $MajorTimeMarks = $TimeMarks[$TimeMarksIndex - 1];
    124   $MinorTimeMarks = $TimeMarks[$TimeMarksIndex - 2]; 
     124  $MinorTimeMarks = $TimeMarks[$TimeMarksIndex - 2];
    125125
    126   $TimeShift = AlignTime($StartTime, $MajorTimeMarks) - $StartTime; 
     126  $TimeShift = AlignTime($StartTime, $MajorTimeMarks) - $StartTime;
    127127  //imagestring($Image, 10, 40, 50, $TimeShift, $Black);
    128128
     
    134134    for($X=1; $X < $Width; $X = $X + 3) imagesetpixel($Image, $X, $Y, $Gray);
    135135    //imageline($Image, 30, $Y, $Width-1, $Y, IMG_COLOR_STYLED);
    136   } 
     136  }
    137137
    138   $TimeShift = AlignTime($StartTime, $MinorTimeMarks) - $StartTime; 
     138  $TimeShift = AlignTime($StartTime, $MinorTimeMarks) - $StartTime;
    139139
    140140  // Zobraz měřítko X
     
    142142  for($Time = $StartTime; $Time < $EndTime; $Time += $MajorTimeMarks)
    143143  {
    144     $X = round(($Time - $StartTime + $TimeShift) / $TimeRange * $Width) % $Width; 
     144    $X = round(($Time - $StartTime + $TimeShift) / $TimeRange * $Width) % $Width;
    145145    //imageline($Image, 30, $Y, $Width-1, $Y, IMG_COLOR_STYLED);
    146146    if(($MajorTimeMarks > 60*60*24)) $Text = date('j.n.Y', $Time + $TimeShift);
Note: See TracChangeset for help on using the changeset viewer.