MDL-55030 core: Bar charts defaults to using a Y axis starting at 0

Part of MDL-54987 epic.
This commit is contained in:
Frederic Massart
2016-07-25 10:42:42 +01:00
committed by Dan Poltawski
parent 826ade18f1
commit 299e9aba66
3 changed files with 14 additions and 1 deletions
+1 -1
View File
@@ -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});
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});
+6
View File
@@ -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;
});
+7
View File
@@ -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);
}
}