MDL-54987 core: New charting API
[moodle.git] / lib / amd / build / chart_output_chartjs.min.js
1 define(["jquery","core/chartjs","core/chart_output_base"],function(a,b,c){function d(){c.prototype.constructor.apply(this,arguments),this._build()}return d.prototype=Object.create(c.prototype),d.prototype._config=null,d.prototype._chartjs=null,d.prototype.getDatasets=function(){var a=this._chart.getSeries().map(function(a){return{label:a.getLabel(),data:a.getValues(),type:a.getType(),fill:!1,borderColor:a.getColor(),backgroundColor:a.getColor()}});return a},d.prototype._build=function(){this._config=this._makeConfig(),this._chartjs=new b(this._node[0],this._config)},d.prototype._makeConfig=function(){var a={type:this._chart.getType(),data:{labels:this._chart.getLabels(),datasets:this.getDatasets()},options:{}};return a},d.prototype.update=function(){a.extend(!0,this._config,this._makeConfig()),this._chartjs.update()},d});