Differences Between: [Versions 310 and 400] [Versions 39 and 400] [Versions 400 and 401] [Versions 400 and 402] [Versions 400 and 403]
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 bar. 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 /** 29 * Chart bar class. 30 * 31 * @package core 32 * @copyright 2016 Frédéric Massart - FMCorz.net 33 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 34 */ 35 class chart_bar extends chart_base { 36 37 /** @var bool Whether the bars should be displayed horizontally or not. */ 38 protected $horizontal = false; 39 /** @var bool Whether the chart should be stacked or not. */ 40 protected $stacked = null; 41 /** 42 * Add the horizontal to the parent and return the serialized data. 43 * 44 * @return array 45 */ 46 public function jsonSerialize() { 47 $data = parent::jsonSerialize(); 48 $data['horizontal'] = $this->get_horizontal(); 49 $data['stacked'] = $this->get_stacked(); 50 return $data; 51 } 52 53 /** 54 * Set the defaults. 55 */ 56 protected function set_defaults() { 57 parent::set_defaults(); 58 $yaxis = $this->get_yaxis(0, true); 59 $yaxis->set_min(0); 60 } 61 62 /** 63 * Get whether the bars should be displayed horizontally or not. 64 * 65 * @return bool 66 */ 67 public function get_horizontal() { 68 return $this->horizontal; 69 } 70 71 /** 72 * Get whether the bars should be stacked or not. 73 * 74 * @return bool 75 */ 76 public function get_stacked() { 77 return $this->stacked; 78 } 79 80 /** 81 * Set whether the bars should be displayed horizontally or not. 82 * 83 * @param bool $horizontal True if the bars should be displayed horizontally, false otherwise. 84 */ 85 public function set_horizontal($horizontal) { 86 $this->horizontal = $horizontal; 87 } 88 89 /** 90 * Set whether the bars should be stacked or not. 91 * 92 * @param bool $stacked True if the chart should be stacked or false otherwise. 93 */ 94 public function set_stacked($stacked) { 95 $this->stacked = $stacked; 96 } 97 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body