|
|
8 |
define("core/chart_output_htmltable",["jquery","core/chart_output_base"],(function($,Base){function Output(){Base.prototype.constructor.apply(this,arguments),this._build()}return Output.prototype=Object.create(Base.prototype),Output.prototype._build=function(){this._node.empty(),this._node.append(this._makeTable())},Output.prototype._makeTable=function(){var node,value,tbl=$("<table>"),c=this._chart,labels=c.getLabels(),hasLabel=labels.length>0,series=c.getSeries(),rowCount=series[0].getCount();tbl.addClass("chart-output-htmltable generaltable"),null!==c.getTitle()&&tbl.append($("<caption>").text(c.getTitle())),node=$("<tr>"),hasLabel&&node.append($("<td>")),series.forEach((function(serie){node.append($("<th>").text(serie.getLabel()).attr("scope","col"))})),tbl.append(node);for(var rowId=0;rowId<rowCount;rowId++){node=$("<tr>"),labels.length>0&&node.append($("<th>").text(labels[rowId]).attr("scope","row"));for(var serieId=0;serieId<series.length;serieId++)value=series[serieId].getValues()[rowId],null!==series[serieId].getLabels()&&(value=series[serieId].getLabels()[rowId]),node.append($("<td>").text(value));tbl.append(node)}return tbl},Output.prototype.update=function(){this._build()},Output}));
|