Proyectos de Subversion Moodle

Rev

Autoría | Ultima modificación | Ver Log |

{"version":3,"file":"chart_bar.min.js","sources":["../src/chart_bar.js"],"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 bar.\n *\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_bar\n */\ndefine(['core/chart_base'], function(Base) {\n\n    /**\n     * Bar chart.\n     *\n     * @extends {module:core/chart_base}\n     * @class\n     */\n    function Bar() {\n        Base.prototype.constructor.apply(this, arguments);\n    }\n    Bar.prototype = Object.create(Base.prototype);\n\n    /**\n     * Whether the bars should be displayed horizontally or not.\n     *\n     * @type {Bool}\n     * @protected\n     */\n    Bar.prototype._horizontal = false;\n\n    /**\n     * Whether the bars should be stacked or not.\n     *\n     * @type {Bool}\n     * @protected\n     */\n    Bar.prototype._stacked = false;\n\n    /** @override */\n    Bar.prototype.TYPE = 'bar';\n\n    /** @override */\n    Bar.prototype.create = function(Klass, data) {\n        var chart = Base.prototype.create.apply(this, arguments);\n        chart.setHorizontal(data.horizontal);\n        chart.setStacked(data.stacked);\n        return chart;\n    };\n\n    /** @override */\n    Bar.prototype._setDefaults = function() {\n        Base.prototype._setDefaults.apply(this, arguments);\n        var axis = this.getYAxis(0, true);\n        axis.setMin(0);\n    };\n\n    /**\n     * Get whether the bars should be displayed horizontally or not.\n     *\n     * @returns {Bool}\n     */\n    Bar.prototype.getHorizontal = function() {\n        return this._horizontal;\n    };\n\n    /**\n     * Get whether the bars should be stacked or not.\n     *\n     * @returns {Bool}\n     */\n    Bar.prototype.getStacked = function() {\n        return this._stacked;\n    };\n\n    /**\n     * Set whether the bars should be displayed horizontally or not.\n     *\n     * It sets the X Axis to zero if the min value is null.\n     *\n     * @param {Bool} horizontal True if the bars should be displayed horizontally, false otherwise.\n     */\n    Bar.prototype.setHorizontal = function(horizontal) {\n        var axis = this.getXAxis(0, true);\n        if (axis.getMin() === null) {\n            axis.setMin(0);\n        }\n        this._horizontal = Boolean(horizontal);\n    };\n\n    /**\n     * Set whether the bars should be stacked or not.\n     *\n     * @method setStacked\n     * @param {Bool} stacked True if the chart should be stacked or false otherwise.\n     */\n    Bar.prototype.setStacked = function(stacked) {\n        this._stacked = Boolean(stacked);\n    };\n\n    return Bar;\n\n});\n"],"names":["define","Base","Bar","prototype","constructor","apply","this","arguments","Object","create","_horizontal","_stacked","TYPE","Klass","data","chart","setHorizontal","horizontal","setStacked","stacked","_setDefaults","axis","getYAxis","setMin","getHorizontal","getStacked","getXAxis","getMin","Boolean"],"mappings":";;;;;;;AAsBAA,wBAAO,CAAC,oBAAoB,SAASC,eAQxBC,MACLD,KAAKE,UAAUC,YAAYC,MAAMC,KAAMC,kBAE3CL,IAAIC,UAAYK,OAAOC,OAAOR,KAAKE,WAQnCD,IAAIC,UAAUO,aAAc,EAQ5BR,IAAIC,UAAUQ,UAAW,EAGzBT,IAAIC,UAAUS,KAAO,MAGrBV,IAAIC,UAAUM,OAAS,SAASI,MAAOC,UAC/BC,MAAQd,KAAKE,UAAUM,OAAOJ,MAAMC,KAAMC,kBAC9CQ,MAAMC,cAAcF,KAAKG,YACzBF,MAAMG,WAAWJ,KAAKK,SACfJ,OAIXb,IAAIC,UAAUiB,aAAe,WACzBnB,KAAKE,UAAUiB,aAAaf,MAAMC,KAAMC,eACpCc,KAAOf,KAAKgB,SAAS,GAAG,GAC5BD,KAAKE,OAAO,IAQhBrB,IAAIC,UAAUqB,cAAgB,kBACnBlB,KAAKI,aAQhBR,IAAIC,UAAUsB,WAAa,kBAChBnB,KAAKK,UAUhBT,IAAIC,UAAUa,cAAgB,SAASC,gBAC/BI,KAAOf,KAAKoB,SAAS,GAAG,GACN,OAAlBL,KAAKM,UACLN,KAAKE,OAAO,QAEXb,YAAckB,QAAQX,aAS/Bf,IAAIC,UAAUe,WAAa,SAASC,cAC3BR,SAAWiB,QAAQT,UAGrBjB"}