]> git.mjollnir.org Git - moodle.git/commitdiff
If the array y_tick_labels is defined, then these are used instead of
authormartin <martin>
Sat, 13 Apr 2002 02:49:21 +0000 (02:49 +0000)
committermartin <martin>
Sat, 13 Apr 2002 02:49:21 +0000 (02:49 +0000)
numbers on the left-hand y-axis.  See mod/survey/graph.php for usage.

lib/graphlib.php

index f742f45ce756b718bf20a92615b1d34becf6c0d0..e566df522f9decb5e8e324b22fef2831ab5836c1 100644 (file)
@@ -939,6 +939,7 @@ function init_y_axis() {
   $axis_size       = $this->parameter['axis_size'];\r
   $axis_colour     = $this->parameter['axis_colour'];\r
   $axis_angle      = $this->parameter['y_axis_angle'];\r
+  $y_tick_labels   = $this->y_tick_labels;\r
 \r
   $this->calculated['y_axis_left']['has_data'] = FALSE;\r
   $this->calculated['y_axis_right']['has_data'] = FALSE;\r
@@ -979,7 +980,11 @@ function init_y_axis() {
   if ($this->parameter['y_axis_text_left']) {\r
     for ($i = 0; $i < $this->parameter['y_axis_gridlines']; $i++) { // calculate y axis text sizes\r
       // left y axis\r
-      $value = number_format($startLeft, $this->parameter['y_decimal_left'], $this->parameter['decimal_point'], $this->parameter['thousand_sep']);\r
+      if ($y_tick_labels) {\r
+        $value = $y_tick_labels[$i];\r
+      } else {\r
+        $value = number_format($startLeft, $this->parameter['y_decimal_left'], $this->parameter['decimal_point'], $this->parameter['thousand_sep']);\r
+      }\r
       $this->calculated['y_axis_left']['data'][$i]  = $startLeft;\r
       $this->calculated['y_axis_left']['text'][$i]  = $value; // text is formatted raw data\r
 \r