1 |
efrain |
1 |
// This file is part of Moodle - http://moodle.org/
|
|
|
2 |
//
|
|
|
3 |
// Moodle is free software: you can redistribute it and/or modify
|
|
|
4 |
// it under the terms of the GNU General Public License as published by
|
|
|
5 |
// the Free Software Foundation, either version 3 of the License, or
|
|
|
6 |
// (at your option) any later version.
|
|
|
7 |
//
|
|
|
8 |
// Moodle is distributed in the hope that it will be useful,
|
|
|
9 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
10 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
11 |
// GNU General Public License for more details.
|
|
|
12 |
//
|
|
|
13 |
// You should have received a copy of the GNU General Public License
|
|
|
14 |
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
|
|
15 |
|
|
|
16 |
/**
|
|
|
17 |
* Chart output base.
|
|
|
18 |
*
|
|
|
19 |
* This takes a chart object and draws it.
|
|
|
20 |
*
|
|
|
21 |
* @copyright 2016 Frédéric Massart - FMCorz.net
|
|
|
22 |
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
|
|
23 |
* @module core/chart_output_base
|
|
|
24 |
*/
|
|
|
25 |
define(['jquery'], function($) {
|
|
|
26 |
|
|
|
27 |
/**
|
|
|
28 |
* Chart output base.
|
|
|
29 |
*
|
|
|
30 |
* The constructor of an output class must instantly generate and display the
|
|
|
31 |
* chart. It is also the responsability of the output module to check that
|
|
|
32 |
* the node received is of the appropriate type, if not a new node can be
|
|
|
33 |
* added within.
|
|
|
34 |
*
|
|
|
35 |
* The output module has total control over the content of the node and can
|
|
|
36 |
* clear it or output anything to it at will. A node should not be shared by
|
|
|
37 |
* two simultaneous output modules.
|
|
|
38 |
*
|
|
|
39 |
* @class
|
|
|
40 |
* @param {Node} node The node to output with/in.
|
|
|
41 |
* @param {Chart} chart A chart object.
|
|
|
42 |
*/
|
|
|
43 |
function Base(node, chart) {
|
|
|
44 |
this._node = $(node);
|
|
|
45 |
this._chart = chart;
|
|
|
46 |
}
|
|
|
47 |
|
|
|
48 |
/**
|
|
|
49 |
* Update method.
|
|
|
50 |
*
|
|
|
51 |
* This is the public method through which an output instance in informed
|
|
|
52 |
* that the chart instance has been updated and they need to update the
|
|
|
53 |
* chart rendering.
|
|
|
54 |
*
|
|
|
55 |
* @abstract
|
|
|
56 |
* @return {Void}
|
|
|
57 |
*/
|
|
|
58 |
Base.prototype.update = function() {
|
|
|
59 |
throw new Error('Not supported.');
|
|
|
60 |
};
|
|
|
61 |
|
|
|
62 |
return Base;
|
|
|
63 |
|
|
|
64 |
});
|