moodle/lib/amd/build/chart_output_htmltable.min.js
2016-07-25 10:43:08 +01:00

1 line
873 B
JavaScript

define(["jquery","core/chart_output_base"],function(a,b){function c(){b.prototype.constructor.apply(this,arguments),this._build()}return c.prototype=Object.create(b.prototype),c.prototype._build=function(){this._node.empty(),this._node.append(this._makeTable())},c.prototype._makeTable=function(){var b,c,d=a("<table>"),e=this._chart,f=e.getLabels(),g=f.length>0,h=e.getSeries(),i=h[0].getCount();d.addClass("chart-output-htmltable"),null!==e.getTitle()&&d.append(a("<caption>").text(e.getTitle())),b=a("<tr>"),g&&b.append(a("<td>")),h.forEach(function(c){b.append(a("<th>").text(c.getLabel()).attr("scope","col"))}),d.append(b);for(var j=0;i>j;j++){b=a("<tr>"),f.length>0&&b.append(a("<th>").text(f[j]).attr("scope","row"));for(var k=0;k<h.length;k++)c=h[k].getValues()[j],b.append(a("<td>").text(c));d.append(b)}return d},c.prototype.update=function(){this._build()},c});