mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
1 line
4.3 KiB
Plaintext
1 line
4.3 KiB
Plaintext
{"version":3,"file":"chart_pie.min.js","sources":["../src/chart_pie.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 pie.\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_pie\n */\ndefine(['core/chart_base'], function(Base) {\n\n /**\n * Pie chart.\n *\n * @class\n * @extends {module:core/chart_base}\n */\n function Pie() {\n Base.prototype.constructor.apply(this, arguments);\n }\n Pie.prototype = Object.create(Base.prototype);\n\n /** @override */\n Pie.prototype.TYPE = 'pie';\n\n /**\n * Whether the chart should be displayed as doughnut or not.\n *\n * @type {Bool}\n * @protected\n */\n Pie.prototype._doughnut = null;\n\n /** @override */\n Pie.prototype.create = function(Klass, data) {\n var chart = Base.prototype.create.apply(this, arguments);\n chart.setDoughnut(data.doughnut);\n return chart;\n };\n\n /**\n * Overridden to add appropriate colors to the series.\n *\n * @override\n */\n Pie.prototype.addSeries = function(series) {\n if (series.getColor() === null) {\n var colors = [];\n var configColorSet = this.getConfigColorSet() || Base.prototype.COLORSET;\n for (var i = 0; i < series.getCount(); i++) {\n colors.push(configColorSet[i % configColorSet.length]);\n }\n series.setColors(colors);\n }\n return Base.prototype.addSeries.apply(this, arguments);\n };\n\n /**\n * Get whether the chart should be displayed as doughnut or not.\n *\n * @method getDoughnut\n * @returns {Bool}\n */\n Pie.prototype.getDoughnut = function() {\n return this._doughnut;\n };\n\n /**\n * Set whether the chart should be displayed as doughnut or not.\n *\n * @method setDoughnut\n * @param {Bool} doughnut True for doughnut type, false for pie.\n */\n Pie.prototype.setDoughnut = function(doughnut) {\n this._doughnut = Boolean(doughnut);\n };\n\n /**\n * Validate a series.\n *\n * Overrides parent implementation to validate that there is only\n * one series per chart instance.\n *\n * @override\n */\n Pie.prototype._validateSeries = function() {\n if (this._series.length >= 1) {\n throw new Error('Pie charts only support one serie.');\n }\n return Base.prototype._validateSeries.apply(this, arguments);\n };\n\n return Pie;\n\n});\n"],"names":["define","Base","Pie","prototype","constructor","apply","this","arguments","Object","create","TYPE","_doughnut","Klass","data","chart","setDoughnut","doughnut","addSeries","series","getColor","colors","configColorSet","getConfigColorSet","COLORSET","i","getCount","push","length","setColors","getDoughnut","Boolean","_validateSeries","_series","Error"],"mappings":";;;;;;;AAsBAA,wBAAO,CAAC,oBAAoB,SAASC,eAQxBC,MACLD,KAAKE,UAAUC,YAAYC,MAAMC,KAAMC,kBAE3CL,IAAIC,UAAYK,OAAOC,OAAOR,KAAKE,WAGnCD,IAAIC,UAAUO,KAAO,MAQrBR,IAAIC,UAAUQ,UAAY,KAG1BT,IAAIC,UAAUM,OAAS,SAASG,MAAOC,UAC/BC,MAAQb,KAAKE,UAAUM,OAAOJ,MAAMC,KAAMC,kBAC9CO,MAAMC,YAAYF,KAAKG,UAChBF,OAQXZ,IAAIC,UAAUc,UAAY,SAASC,WACL,OAAtBA,OAAOC,WAAqB,SACxBC,OAAS,GACTC,eAAiBf,KAAKgB,qBAAuBrB,KAAKE,UAAUoB,SACvDC,EAAI,EAAGA,EAAIN,OAAOO,WAAYD,IACnCJ,OAAOM,KAAKL,eAAeG,EAAIH,eAAeM,SAElDT,OAAOU,UAAUR,eAEdnB,KAAKE,UAAUc,UAAUZ,MAAMC,KAAMC,YAShDL,IAAIC,UAAU0B,YAAc,kBACjBvB,KAAKK,WAShBT,IAAIC,UAAUY,YAAc,SAASC,eAC5BL,UAAYmB,QAAQd,WAW7Bd,IAAIC,UAAU4B,gBAAkB,cACxBzB,KAAK0B,QAAQL,QAAU,QACjB,IAAIM,MAAM,6CAEbhC,KAAKE,UAAU4B,gBAAgB1B,MAAMC,KAAMC,YAG/CL"} |