diff --git a/lib/amd/build/chart_bar.min.js b/lib/amd/build/chart_bar.min.js index 6083d244bdb..2b3127c6677 100644 --- a/lib/amd/build/chart_bar.min.js +++ b/lib/amd/build/chart_bar.min.js @@ -1 +1 @@ -define(["core/chart_base"],function(a){function b(){a.prototype.constructor.apply(this,arguments)}return b.prototype=Object.create(a.prototype),b.prototype.TYPE="bar",b}); \ No newline at end of file +define(["core/chart_base"],function(a){function b(){a.prototype.constructor.apply(this,arguments)}return b.prototype=Object.create(a.prototype),b.prototype.TYPE="bar",b.prototype._setDefaults=function(){a.prototype._setDefaults.apply(this,arguments);var b=this.getYAxis(0,!0);b.setMin(0)},b}); \ No newline at end of file diff --git a/lib/amd/src/chart_bar.js b/lib/amd/src/chart_bar.js index e1e118a2c87..4b6fdcc2ddb 100644 --- a/lib/amd/src/chart_bar.js +++ b/lib/amd/src/chart_bar.js @@ -32,6 +32,12 @@ define(['core/chart_base'], function(Base) { Bar.prototype.TYPE = 'bar'; + Bar.prototype._setDefaults = function() { + Base.prototype._setDefaults.apply(this, arguments); + var axis = this.getYAxis(0, true); + axis.setMin(0); + }; + return Bar; }); diff --git a/lib/classes/chart_bar.php b/lib/classes/chart_bar.php index ddaa8560ecb..46f895ee824 100644 --- a/lib/classes/chart_bar.php +++ b/lib/classes/chart_bar.php @@ -33,4 +33,11 @@ defined('MOODLE_INTERNAL') || die(); * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class chart_bar extends chart_base { + + protected function set_defaults() { + parent::set_defaults(); + $yaxis = $this->get_yaxis(0, true); + $yaxis->set_min(0); + } + }