Changeset 6 for graph.php


Ignore:
Timestamp:
Oct 16, 2007, 10:12:26 PM (17 years ago)
Author:
george
Message:

Přepracovaná vývojová verze s oddělenými datovými tabulkami a různými datovými typy.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • graph.php

    r3 r6  
    55  else $Debug = 0;
    66 
    7 $DefaultWidth = 750;
    8 $DefaultHeight = 200;
    9 $K = 0.9;   // Coeficient for decreasing graph height
    10 $FontFile = 'arial.ttf';
    11 $FontSize = 10;
    12 
    137if(!array_key_exists('From',$_GET)) die('Musíte zadat èas poèátku');
    148$StartTime = addslashes($_GET['From']);
     
    4741foreach($Points as $Index => $Item)
    4842{
    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'];
    5246  if($Points[$Index]['avg'] > $MaxValue) $MaxValue = $Points[$Index]['avg'];
    5347  if($Points[$Index]['avg'] < $MinValue) $MinValue = $Points[$Index]['avg'];
     
    5650  $AvgValue = $AvgValue + $Points[$Index]['avg'];
    5751}
    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'];
    6155
    6256// Generate polygon and recalculate y values to fit graph height
     
    9185
    9286
    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);
    9793
    9894// Generate image
     
    182178  $GenerationTime = floor((GetMicrotime() - $StopWatchStart) * 1000  ) / 1000;
    183179
    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']);
    187183  imagestring($Image, 2, 50, 20, 'Vygenerováno za '.$GenerationTime.' sekund', $Black);
    188184  //imagestring($Image, 2, 50, 30, 'Level: '.$Level, $Black);
    189185
    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']));
    191187  imagerectangle($Image, 0, 0, $Width - 1, $Height - 1, $Black);   // Frame border
    192188  imagepng($Image);
Note: See TracChangeset for help on using the changeset viewer.