Changeset 59 for branches/mvc/Application/View/Graph.php
- Timestamp:
- Mar 1, 2015, 12:43:56 PM (10 years ago)
- Location:
- branches/mvc
- Files:
-
- 1 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
branches/mvc/Application/View/Graph.php
r47 r59 6 6 class GraphView extends View 7 7 { 8 var $FontSize; 9 var $FontFileName; 10 var $ValueToImageHeigthCoefficient; 8 11 var $DefaultWidth; 9 12 var $DefaultHeight; … … 14 17 $this->DefaultWidth = 800; 15 18 $this->DefaultHeight = 200; 19 $this->FontSize = 10; 20 $this->FontFileName = 'Arial.ttf'; 21 $this->ValueToImageHeigthCoefficient = 0.9; 16 22 } 17 23 … … 35 41 if(!array_key_exists('Differential', $_GET)) $Differential = $this->Config['Application']['DefaultVariables']['Differential']; 36 42 else $Differential = addslashes($_GET['Differential']); 37 $VerticalLinesCount = round($Height / ($this->Config['Application']['FontSize'] + 4)); 38 43 $VerticalLinesCount = round($Height / ($this->FontSize + 4)); 44 45 $PrefixMultiplier = new PrefixMultiplier(); 39 46 $StopWatchStart = $this->System->GetMicrotime(); 40 47 … … 50 57 $MeasureMethod = $DbResult2->fetch_assoc(); 51 58 52 $FontSize = $this-> Config['Application']['FontSize'];53 $FontFile = dirname(__FILE__).'/../Style/'.$this->Config['System']['Style'].'/'.$this-> Config['Application']['FontFileName'];59 $FontSize = $this->FontSize; 60 $FontFile = dirname(__FILE__).'/../Style/'.$this->Config['System']['Style'].'/'.$this->FontFileName; 54 61 55 62 $Level = floor(log(($EndTime - $StartTime) / $Measure->DivisionCount / 60) / log($Measure->LevelReducing)) - 1; … … 92 99 { 93 100 $PointsMin[] = $Index * $Width / $Measure->DivisionCount; 94 $PointsMin[] = $Height - 1 - ($Points[$Index]['Min'] - $MinValue) / ($MaxValue - $MinValue) * $Height * $this->Config['Application']['ValueToImageHeigthCoefficient']; 101 $PointsMin[] = $Height - 1 - ($Points[$Index]['Min'] - $MinValue) / 102 ($MaxValue - $MinValue) * $Height * $this->ValueToImageHeigthCoefficient; 95 103 $PointsAvg[] = $Index * $Width / $Measure->DivisionCount; 96 $PointsAvg[] = $Height - 1 - ($Points[$Index]['Avg'] - $MinValue) / ($MaxValue - $MinValue) * $Height * $this->Config['Application']['ValueToImageHeigthCoefficient']; 104 $PointsAvg[] = $Height - 1 - ($Points[$Index]['Avg'] - $MinValue) / 105 ($MaxValue - $MinValue) * $Height * $this->ValueToImageHeigthCoefficient; 97 106 $PointsMax[] = $Index * $Width / $Measure->DivisionCount; 98 $PointsMax[] = $Height - 1 - ($Points[$Index]['Max'] - $MinValue) / ($MaxValue - $MinValue) * $Height * $this->Config['Application']['ValueToImageHeigthCoefficient']; 107 $PointsMax[] = $Height - 1 - ($Points[$Index]['Max'] - $MinValue) / 108 ($MaxValue - $MinValue) * $Height * $this->ValueToImageHeigthCoefficient; 99 109 //echo($Index.' - '.$Item.' '.$Points[$Index].'<br/>'); 100 110 } … … 113 123 $PointsMax[] = $Height - 1; 114 124 115 116 125 //array_unshift($Points, $Height - 1); 117 126 //array_unshift($Points, 0); 118 127 //$Points[] = $Width - 1; 119 128 //$Points[] = $Height - 1; echo('sds'); 120 121 122 129 //print_r($PointsMax); 123 130 … … 179 186 { 180 187 for($Y = 0; $Y < $Height; $Y = $Y + 1) imagesetpixel($Image, $X, $Y, $Gray); 181 imagettftext($Image, $FontSize, 0, $X - ($BoundBox[2] - $BoundBox[0]) / 2, $Height - 2, $Black, $FontFile, $Text); 188 imagettftext($Image, $FontSize, 0, $X - ($BoundBox[2] - $BoundBox[0]) / 2, 189 $Height - 2, $Black, $FontFile, $Text); 182 190 $LastTextEnd = $X + ($BoundBox[2] - $BoundBox[0]) / 2; 183 191 } … … 190 198 $Y = $Height - 1 - ($VerticalLinesDistance * $I); 191 199 //$Y = $Height - 1 - ($VerticalLinesDistance * $I / ($MaxValue - $MinValue) * $this->Config['Application']['ValueToImageHeigthCoefficient'] * $Height); 192 $Text = $this->System->AddPrefixMultipliers(round(($I * $VerticalLinesDistance / $Height / $this->Config['Application']['ValueToImageHeigthCoefficient'] * ($MaxValue - $MinValue) + $MinValue)), $MeasureMethod['Unit'], 3); 200 $Text = $PrefixMultiplier->Add(round(($I * $VerticalLinesDistance / 201 $Height / $this->ValueToImageHeigthCoefficient * ($MaxValue - $MinValue) + $MinValue)), $MeasureMethod['Unit'], 3); 193 202 $BoundBox = imagettfbbox($FontSize, 0, $FontFile, $Text); 194 203 if(($Y - ($BoundBox[5] - $BoundBox[1]) / 2) > 10) … … 198 207 199 208 $Left = $Width - 10; 200 $Text = ' Max. '.$ this->System->AddPrefixMultipliers($MaxValue, $MeasureMethod['Unit']);209 $Text = ' Max. '.$PrefixMultiplier->Add($MaxValue, $MeasureMethod['Unit']); 201 210 $BoundingBox = imagettfbbox($FontSize, 0, $FontFile, $Text); 202 211 $Left -= ($BoundingBox[2] - $BoundingBox[0]); 203 212 imagettftext($Image, $FontSize, 0, $Left, 14, $Red, $FontFile, $Text); 204 213 205 $Text = ' Avg. '.$ this->System->AddPrefixMultipliers($AvgValue, $MeasureMethod['Unit']);214 $Text = ' Avg. '.$PrefixMultiplier->Add($AvgValue, $MeasureMethod['Unit']); 206 215 $BoundingBox = imagettfbbox($FontSize, 0, $FontFile, $Text); 207 216 $Left -= ($BoundingBox[2] - $BoundingBox[0]); 208 217 imagettftext($Image, $FontSize, 0, $Left, 14, $Green, $FontFile, $Text); 209 218 210 $Text = ' Min. '.$ this->System->AddPrefixMultipliers($MinValue, $MeasureMethod['Unit']);219 $Text = ' Min. '.$PrefixMultiplier->Add($MinValue, $MeasureMethod['Unit']); 211 220 $BoundingBox = imagettfbbox($FontSize, 0, $FontFile, $Text); 212 221 $Left -= ($BoundingBox[2] - $BoundingBox[0]);
Note:
See TracChangeset
for help on using the changeset viewer.