]> git.mjollnir.org Git - moodle.git/commitdiff
graphlib - MDL-20855 fix alignemnt issue with the x-axis.
authorTim Hunt <T.J.Hunt@open.ac.uk>
Thu, 19 Nov 2009 16:56:47 +0000 (16:56 +0000)
committerTim Hunt <T.J.Hunt@open.ac.uk>
Thu, 19 Nov 2009 16:56:47 +0000 (16:56 +0000)
Labels with a descender (e.g. May) appeared lower than ones without (e.g. Jun).
Text is drawn baseline aligned, not bottom aligned,and so the code was computing the position wrongly.

lib/graphlib.php

index d289e1ee3bb5ffbc48163d389b6112e6e514ea91..91a16dc8e5791ac09e71e6cb8709c33b866964af 100644 (file)
@@ -512,7 +512,7 @@ class graph {
       $label = $this->calculated['x_label'];
       $coords = array('x' => $x, 'y' => $y, 'reference' => 'top-center');
       $this->update_boundaryBox($label['boundary_box'], $coords);
-     $this->print_TTF($label);
+      $this->print_TTF($label);
     }
 
     function draw_zero_axis_left() {
@@ -1371,7 +1371,7 @@ class graph {
       } else {
         $width = abs($bounds[4]-$bounds[6]);
         $height = abs($bounds[7]-$bounds[1]);
-        $offsetY = 0;
+        $offsetY = $bounds[1];
         $offsetX = 0;
       }