/
var
/
www
/
html
/
lgpd
/
lib
/
amd
/
build
/
Upload File
HOME
{"version":3,"sources":["../src/chart_axis.js"],"names":["define","Axis","prototype","POS_DEFAULT","POS_BOTTOM","POS_LEFT","POS_RIGHT","POS_TOP","_label","_labels","_max","_min","_position","_stepSize","create","obj","s","setPosition","position","setLabel","label","setStepSize","stepSize","setMax","max","setMin","min","setLabels","labels","getLabel","getLabels","getMax","getMin","getPosition","getStepSize","length","Error","isNaN"],"mappings":"AAuBAA,OAAM,mBAAC,EAAD,CAAK,UAAW,CAUlB,QAASC,CAAAA,CAAT,EAAgB,CAEf,CAMDA,CAAI,CAACC,SAAL,CAAeC,WAAf,CAA6B,IAA7B,CAMAF,CAAI,CAACC,SAAL,CAAeE,UAAf,CAA4B,QAA5B,CAMAH,CAAI,CAACC,SAAL,CAAeG,QAAf,CAA0B,MAA1B,CAMAJ,CAAI,CAACC,SAAL,CAAeI,SAAf,CAA2B,OAA3B,CAMAL,CAAI,CAACC,SAAL,CAAeK,OAAf,CAAyB,KAAzB,CAOAN,CAAI,CAACC,SAAL,CAAeM,MAAf,CAAwB,IAAxB,CAOAP,CAAI,CAACC,SAAL,CAAeO,OAAf,CAAyB,IAAzB,CAOAR,CAAI,CAACC,SAAL,CAAeQ,IAAf,CAAsB,IAAtB,CAOAT,CAAI,CAACC,SAAL,CAAeS,IAAf,CAAsB,IAAtB,CAOAV,CAAI,CAACC,SAAL,CAAeU,SAAf,CAA2B,IAA3B,CAOAX,CAAI,CAACC,SAAL,CAAeW,SAAf,CAA2B,IAA3B,CAUAZ,CAAI,CAACC,SAAL,CAAeY,MAAf,CAAwB,SAASC,CAAT,CAAc,CAClC,GAAIC,CAAAA,CAAC,CAAG,GAAIf,CAAAA,CAAZ,CACAe,CAAC,CAACC,WAAF,CAAcF,CAAG,CAACG,QAAlB,EACAF,CAAC,CAACG,QAAF,CAAWJ,CAAG,CAACK,KAAf,EACAJ,CAAC,CAACK,WAAF,CAAcN,CAAG,CAACO,QAAlB,E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C,SAAL,CAAeqB,MAAf,CAAwB,SAASC,CAAT,CAAc,CAClC,KAAKd,IAAL,CAA2B,WAAf,QAAOc,CAAAA,CAAP,CAA6BA,CAA7B,CAAmC,IAClD,CAFD,CAaAvB,CAAI,CAACC,SAAL,CAAeuB,MAAf,CAAwB,SAASC,CAAT,CAAc,CAClC,KAAKf,IAAL,CAA2B,WAAf,QAAOe,CAAAA,CAAP,CAA6BA,CAA7B,CAAmC,IAClD,CAFD,CAiBAzB,CAAI,CAACC,SAAL,CAAee,WAAf,CAA6B,SAASC,CAAT,CAAmB,CAC5C,GAAIA,CAAQ,EAAI,KAAKf,WAAjB,EACOe,CAAQ,EAAI,KAAKd,UADxB,EAEOc,CAAQ,EAAI,KAAKb,QAFxB,EAGOa,CAAQ,EAAI,KAAKZ,SAHxB,EAIOY,CAAQ,EAAI,KAAKX,OAJ5B,CAIqC,CACjC,KAAM,IAAI6B,CAAAA,KAAJ,CAAU,wBAAV,CACT,CACD,KAAKxB,SAAL,CAAiBM,CACpB,CATD,CAmBAjB,CAAI,CAACC,SAAL,CAAemB,WAAf,CAA6B,SAASC,CAAT,CAAmB,CAC5C,GAAwB,WAApB,QAAOA,CAAAA,CAAP,EAAgD,IAAb,GAAAA,CAAvC,CAA0D,CACtDA,CAAQ,CAAG,IACd,CAFD,IAEO,IAAIe,KAAK,EAAQf,CAAR,CAAT,CAA6B,CAChC,KAAM,IAAIc,CAAAA,KAAJ,CAAU,qCAAV,CACT,CAFM,IAEA,CACHd,CAAQ,EAAUA,CACrB,CAED,KAAKT,SAAL,CAAiBS,CACpB,CAVD,CAYA,MAAOrB,CAAAA,CAEV,CAnRK,CAAN","sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Chart axis.\n *\n * @package core\n * @copyright 2016 Frédéric Massart - FMCorz.net\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n * @module core/chart_axis\n */\ndefine([], function() {\n\n /**\n * Chart axis class.\n *\n * This is used to represent an axis, whether X or Y.\n *\n * @alias module:core/chart_axis\n * @class\n */\n function Axis() {\n // Please eslint no-empty-function.\n }\n\n /**\n * Default axis position.\n * @const {Null}\n */\n Axis.prototype.POS_DEFAULT = null;\n\n /**\n * Bottom axis position.\n * @const {String}\n */\n Axis.prototype.POS_BOTTOM = 'bottom';\n\n /**\n * Left axis position.\n * @const {String}\n */\n Axis.prototype.POS_LEFT = 'left';\n\n /**\n * Right axis position.\n * @const {String}\n */\n Axis.prototype.POS_RIGHT = 'right';\n\n /**\n * Top axis position.\n * @const {String}\n */\n Axis.prototype.POS_TOP = 'top';\n\n /**\n * Label of the axis.\n * @type {String}\n * @protected\n */\n Axis.prototype._label = null;\n\n /**\n * Labels of the ticks.\n * @type {String[]}\n * @protected\n */\n Axis.prototype._labels = null;\n\n /**\n * Maximum value of the axis.\n * @type {Number}\n * @protected\n */\n Axis.prototype._max = null;\n\n /**\n * Minimum value of the axis.\n * @type {Number}\n * @protected\n */\n Axis.prototype._min = null;\n\n /**\n * Position of the axis.\n * @type {String}\n * @protected\n */\n Axis.prototype._position = null;\n\n /**\n * Steps on the axis.\n * @type {Number}\n * @protected\n */\n Axis.prototype._stepSize = null;\n\n /**\n * Create a new instance of an axis from serialised data.\n *\n * @static\n * @method create\n * @param {Object} obj The data of the axis.\n * @return {module:core/chart_axis}\n */\n Axis.prototype.create = function(obj) {\n var s = new Axis();\n s.setPosition(obj.position);\n s.setLabel(obj.label);\n s.setStepSize(obj.stepSize);\n s.setMax(obj.max);\n s.setMin(obj.min);\n s.setLabels(obj.labels);\n return s;\n };\n\n /**\n * Get the label of the axis.\n *\n * @method getLabel\n * @return {String}\n */\n Axis.prototype.getLabel = function() {\n return this._label;\n };\n\n /**\n * Get the labels of the ticks of the axis.\n *\n * @method getLabels\n * @return {String[]}\n */\n Axis.prototype.getLabels = function() {\n return this._labels;\n };\n\n /**\n * Get the maximum value of the axis.\n *\n * @method getMax\n * @return {Number}\n */\n Axis.prototype.getMax = function() {\n return this._max;\n };\n\n /**\n * Get the minimum value of the axis.\n *\n * @method getMin\n * @return {Number}\n */\n Axis.prototype.getMin = function() {\n return this._min;\n };\n\n /**\n * Get the position of the axis.\n *\n * @method getPosition\n * @return {String}\n */\n Axis.prototype.getPosition = function() {\n return this._position;\n };\n\n /**\n * Get the step size of the axis.\n *\n * @method getStepSize\n * @return {Number}\n */\n Axis.prototype.getStepSize = function() {\n return this._stepSize;\n };\n\n /**\n * Set the label of the axis.\n *\n * @method setLabel\n * @param {String} label The label.\n */\n Axis.prototype.setLabel = function(label) {\n this._label = label || null;\n };\n\n /**\n * Set the labels of the values on the axis.\n *\n * This automatically sets the [_stepSize]{@link module:core/chart_axis#_stepSize},\n * [_min]{@link module:core/chart_axis#_min} and [_max]{@link module:core/chart_axis#_max}\n * to define a scale from 0 to the number of labels when none of the previously\n * mentioned values have been modified.\n *\n * You can use other values so long that your values in a series are mapped\n * to the values represented by your _min, _max and _stepSize.\n *\n * @method setLabels\n * @param {String[]} labels The labels.\n */\n Axis.prototype.setLabels = function(labels) {\n this._labels = labels || null;\n\n // By default we set the grid according to the labels.\n if (this._labels !== null\n && this._stepSize === null\n && (this._min === null || this._min === 0)\n && this._max === null) {\n this.setStepSize(1);\n this.setMin(0);\n this.setMax(labels.length - 1);\n }\n };\n\n /**\n * Set the maximum value on the axis.\n *\n * When this is not set (or set to null) it is left for the output\n * library to best guess what should be used.\n *\n * @method setMax\n * @param {Number} max The value.\n */\n Axis.prototype.setMax = function(max) {\n this._max = typeof max !== 'undefined' ? max : null;\n };\n\n /**\n * Set the minimum value on the axis.\n *\n * When this is not set (or set to null) it is left for the output\n * library to best guess what should be used.\n *\n * @method setMin\n * @param {Number} min The value.\n */\n Axis.prototype.setMin = function(min) {\n this._min = typeof min !== 'undefined' ? min : null;\n };\n\n /**\n * Set the position of the axis.\n *\n * This does not validate whether or not the constant used is valid\n * as the axis itself is not aware whether it represents the X or Y axis.\n *\n * The output library has to have a fallback in case the values are incorrect.\n * When this is not set to {@link module:core/chart_axis#POS_DEFAULT} it is up\n * to the output library to choose what position fits best.\n *\n * @method setPosition\n * @param {String} position The value.\n */\n Axis.prototype.setPosition = function(position) {\n if (position != this.POS_DEFAULT\n && position != this.POS_BOTTOM\n && position != this.POS_LEFT\n && position != this.POS_RIGHT\n && position != this.POS_TOP) {\n throw new Error('Invalid axis position.');\n }\n this._position = position;\n };\n\n /**\n * Set the stepSize on the axis.\n *\n * This is used to determine where ticks are displayed on the axis between min and max.\n *\n * @method setStepSize\n * @param {Number} stepSize The value.\n */\n Axis.prototype.setStepSize = function(stepSize) {\n if (typeof stepSize === 'undefined' || stepSize === null) {\n stepSize = null;\n } else if (isNaN(Number(stepSize))) {\n throw new Error('Value for stepSize is not a number.');\n } else {\n stepSize = Number(stepSize);\n }\n\n this._stepSize = stepSize;\n };\n\n return Axis;\n\n});\n"],"file":"chart_axis.min.js"}