See Release Notes
Long Term Support Release
Differences Between: [Versions 310 and 401] [Versions 311 and 401] [Versions 39 and 401] [Versions 400 and 401]
1 <?php 2 // This file is part of Moodle - http://moodle.org/ 3 // 4 // Moodle is free software: you can redistribute it and/or modify 5 // it under the terms of the GNU General Public License as published by 6 // the Free Software Foundation, either version 3 of the License, or 7 // (at your option) any later version. 8 // 9 // Moodle is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU General Public License for more details. 13 // 14 // You should have received a copy of the GNU General Public License 15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 16 17 /** 18 * Chart axis. 19 * 20 * @package core 21 * @copyright 2016 Frédéric Massart - FMCorz.net 22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 */ 24 25 namespace core; 26 defined('MOODLE_INTERNAL') || die(); 27 28 use coding_exception; 29 use JsonSerializable; 30 use renderable; 31 32 /** 33 * Chart axis class. 34 * 35 * @package core 36 * @copyright 2016 Frédéric Massart - FMCorz.net 37 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 38 */ 39 class chart_axis implements JsonSerializable { 40 41 /** Default axis position. */ 42 const POS_DEFAULT = null; 43 /** Bottom axis position. */ 44 const POS_BOTTOM = 'bottom'; 45 /** Left axis position. */ 46 const POS_LEFT = 'left'; 47 /** Right axis position. */ 48 const POS_RIGHT = 'right'; 49 /** Top axis position. */ 50 const POS_TOP = 'top'; 51 52 /** @var string The axis label. */ 53 protected $label = null; 54 /** @var string[] The axis labels, tick values. */ 55 protected $labels = null; 56 /** @var float The maximum tick value. */ 57 protected $max = null; 58 /** @var float The minimum tick value. */ 59 protected $min = null; 60 /** @var string The axis position. */ 61 protected $position = self::POS_DEFAULT; 62 /** @var float The stepsize between ticks. */ 63 protected $stepsize = null; 64 65 /** 66 * Constructor. 67 * 68 * Must not take any argument. 69 */ 70 public function __construct() { 71 } 72 73 /** 74 * Get the label. 75 * 76 * @return string 77 */ 78 public function get_label() { 79 return $this->label; 80 } 81 82 /** 83 * Get the labels. 84 * 85 * @return string[] 86 */ 87 public function get_labels() { 88 return $this->labels; 89 } 90 91 /** 92 * Get the max value. 93 * 94 * @return float 95 */ 96 public function get_max() { 97 return $this->max; 98 } 99 100 /** 101 * Get the min value. 102 * 103 * @return float 104 */ 105 public function get_min() { 106 return $this->min; 107 } 108 109 /** 110 * Get the axis position. 111 * 112 * @return string 113 */ 114 public function get_position() { 115 return $this->position; 116 } 117 118 /** 119 * Get the step size. 120 * 121 * @return float 122 */ 123 public function get_stepsize() { 124 return $this->stepsize; 125 } 126 127 /** 128 * Serialize the object. 129 * 130 * @return array 131 */ 132 public function jsonSerialize(): array { 133 return [ 134 'label' => $this->label, 135 'labels' => $this->labels, 136 'max' => $this->max, 137 'min' => $this->min, 138 'position' => $this->position, 139 'stepSize' => $this->stepsize, 140 ]; 141 } 142 143 /** 144 * Set the label. 145 * 146 * @param string $label The label. 147 */ 148 public function set_label($label) { 149 $this->label = $label; 150 } 151 152 /** 153 * Set the labels. 154 * 155 * @param string[] $labels The labels. 156 */ 157 public function set_labels($labels) { 158 $this->labels = $labels; 159 } 160 161 /** 162 * Set the max value. 163 * 164 * @param float $max The max value. 165 */ 166 public function set_max($max) { 167 $this->max = $max; 168 } 169 170 /** 171 * Set the min value. 172 * 173 * @param float $min The min value. 174 */ 175 public function set_min($min) { 176 $this->min = $min; 177 } 178 179 /** 180 * Set the position. 181 * 182 * @param string $position Use constant self::POS_*. 183 */ 184 public function set_position($position) { 185 $this->position = $position; 186 } 187 188 /** 189 * Set the step size. 190 * 191 * @param float $stepsize The step size. 192 */ 193 public function set_stepsize($stepsize) { 194 $this->stepsize = $stepsize; 195 } 196 197 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body