From 858cbfdfd35712671c7bc14a9e43631ddf7f0eb3 Mon Sep 17 00:00:00 2001 From: Simey Lameze Date: Fri, 24 Jun 2016 11:59:32 +0800 Subject: [PATCH] MDL-55013 core: add support for title Part of MDL-54987 epic. --- lib/amd/build/chart_base.min.js | 2 +- lib/amd/build/chart_output_chartjs.min.js | 2 +- lib/amd/src/chart_base.js | 10 ++++++++++ lib/amd/src/chart_output_chartjs.js | 4 ++++ lib/classes/chart_base.php | 11 ++++++++++- 5 files changed, 26 insertions(+), 3 deletions(-) diff --git a/lib/amd/build/chart_base.min.js b/lib/amd/build/chart_base.min.js index 9da29808ea8..ee42009ec89 100644 --- a/lib/amd/build/chart_base.min.js +++ b/lib/amd/build/chart_base.min.js @@ -1 +1 @@ -define(["core/chart_series"],function(a){function b(){this._series=[],this._labels=[]}return b.prototype._series=null,b.prototype._labels=null,b.prototype.COLORSET=["red","green","blue","yellow","pink","orange"],b.prototype.TYPE=null,b.prototype.addSeries=function(a){this._validateSerie(a),this._series.push(a),null===a.getColor()&&a.setColor(b.prototype.COLORSET[this._series.length%b.prototype.COLORSET.length])},b.prototype.create=function(b,c){var d=new b;d.setLabels(c.labels);for(var e=0;e $this->get_type(), 'series' => $this->series, - 'labels' => $this->labels + 'labels' => $this->labels, + 'title' => $this->title ]; } @@ -64,6 +66,10 @@ class chart_base implements JsonSerializable, renderable { return $this->series; } + public function get_title() { + return $this->title; + } + public function get_type() { $classname = get_class($this); return substr($classname, strpos($classname, '_') + 1); @@ -73,4 +79,7 @@ class chart_base implements JsonSerializable, renderable { $this->labels = $labels; } + public function set_title($title) { + $this->title = $title; + } }