Browse Source

Merge pull request #261 from danbarretodev/6876

Fix display issue in gradebook bar charts - refs #6876
Yannick Warnier 11 years ago
parent
commit
b8f5189e91

+ 1 - 0
main/gradebook/lib/fe/flatviewtable.class.php

@@ -308,6 +308,7 @@ class FlatViewTable extends SortableTable
                             //$Test->drawTreshold(0,143,55,72,TRUE,TRUE);
 
                             // Draw the bar graph
+                            $Test->setFontProperties(api_get_path(LIBRARY_PATH)."pchart/fonts/tahoma.ttf",11);
                             $Test->drawBarGraph($DataSet->GetData(),$DataSet->GetDataDescription(),TRUE);
 
                             //Set legend properties: width, height and text color and font

+ 2 - 0
main/inc/lib/pchart/pChart.class.php

@@ -2006,6 +2006,7 @@
            if ( is_numeric($Data[$Key][$ColName]) )
             {
              $Value = $Data[$Key][$ColName];
+             $ValueWidth = strlen("$Value") * 6;
              $YPos = $this->GArea_Y2 - (($Value-$this->VMin) * $this->DivisionRatio);
 
              /* Save point into the image map if option activated */
@@ -2017,6 +2018,7 @@
              if ( $Shadow && $Alpha == 100 )
               $this->drawRectangle($XPos+1,$YZero,$XPos+$SeriesWidth-1,$YPos,25,25,25,TRUE,$Alpha);
              $this->drawFilledRectangle($XPos+1,$YZero,$XPos+$SeriesWidth-1,$YPos,$this->Palette[$ColorID]["R"],$this->Palette[$ColorID]["G"],$this->Palette[$ColorID]["B"],TRUE,$Alpha);
+              imagettftext($this->Picture, $this->FontSize, 0, $XPos + ($SeriesWidth / 2) - ($ValueWidth / 2), $YPos - 2, $ColorID, $this->FontName, $Value);
             }
           }
          $XPos = $XPos + $this->DivisionWidth;