Minor - Improve code style - refs CT#7383

1.9.x
Daniel Barreto 11 years ago
parent 6ac9959a31
commit 22c901cb3a
  1. 31
      main/inc/lib/pchart/pChart.class.php
  2. 20
      plugin/dashboard/block_evaluation_graph/block_evaluation_graph.class.php

@ -619,8 +619,7 @@
// e.g 60 degree is in Quadrant I, 120 degree is Quadrant II
$isYpositive = sin(deg2rad($Angle)) >= 0;
$isXpositive = cos(deg2rad($Angle)) >= 0;
$YPos = $this->GArea_Y2+10;
$YPos = $this->GArea_Y2 + 10;
if ($isYpositive && $isXpositive) {
// For Quadrant I
$YPos += $TextHeight;
@ -636,7 +635,16 @@
// For Quadrant IV
// Nothing to do
}
imagettftext($this->Picture,$this->FontSize,$Angle,$XPos,$YPos,$C_TextColor,$this->FontName,$Value);
imagettftext(
$this->Picture,
$this->FontSize,
$Angle,
$XPos,
$YPos,
$C_TextColor,
$this->FontName,
$Value
);
// post update XY position
if ($isYpositive && $isXpositive) {
// For Quadrant I
@ -660,12 +668,21 @@
}
/* Write the X Axis caption if set */
if ( isset($DataDescription["Axis"]["X"]) )
if (isset($DataDescription["Axis"]["X"]))
{
$Position = imageftbbox($this->FontSize, 0,$this->FontName,$DataDescription["Axis"]["X"]);
$TextWidth = abs($Position[2])+abs($Position[0]);
$Position = imageftbbox($this->FontSize, 0, $this->FontName, $DataDescription["Axis"]["X"]);
$TextWidth = abs($Position[2]) + abs($Position[0]);
$TextLeft = (($this->GArea_X2 + $this->GArea_X1) / 2) - ($TextWidth/2);
imagettftext($this->Picture,$this->FontSize,0,$TextLeft,$YMax+$this->FontSize+5,$C_TextColor,$this->FontName,$DataDescription["Axis"]["X"]);
imagettftext(
$this->Picture,
$this->FontSize,
0,
$TextLeft,
$YMax+$this->FontSize+5,
$C_TextColor,
$this->FontName,
$DataDescription["Axis"]["X"]
);
}
}

@ -294,15 +294,19 @@ class BlockEvaluationGraph extends Block
} else {
// Initialise the graph
$angle = -30;
$test = new pChart($this->bg_width,$this->bg_height);
$test->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf',8);
$test->fixHeightByRotation($data_set->GetData(), $data_set->GetDataDescription(), $angle);
$test->setGraphArea(50, 30, $this->bg_width-75, $this->bg_height-75);
$test = new pChart($this->bg_width, $this->bg_height);
$test->setFontProperties(api_get_path(LIBRARY_PATH) . 'pchart/fonts/tahoma.ttf', 8);
$test->fixHeightByRotation(
$data_set->GetData(),
$data_set->GetDataDescription(),
$angle
);
$test->setGraphArea(50, 30, $this->bg_width - 75, $this->bg_height - 75);
$test->drawFilledRoundedRectangle(
7,
7,
$this->bg_width-20,
$test->YSize-20,
$this->bg_width - 20,
$test->YSize - 20,
5,
240,
240,
@ -311,8 +315,8 @@ class BlockEvaluationGraph extends Block
$test->drawRoundedRectangle(
5,
5,
$this->bg_width-18,
$test->YSize-18,
$this->bg_width - 18,
$test->YSize - 18,
5,
230,
230,

Loading…
Cancel
Save