toolbox配置项中自定义
dataView :
{
show: true,
readOnly: false,
optionToContent : function(opt) {
log(opt);
var axisData = opt.xAxis[0].data;
var series = opt.series;
var tdHeaders = '<td>'+axis[1]+'</td>'; //表头
series.forEach(function(item) {
tdHeaders += '<td>' + item.name + '</td>'; //组装表头
});
var table = '<div class="table-responsive"><table class="table table-bordered table-striped table-hover" style="text-align:center"><tbody><tr>' + tdHeaders + '</tr>';
var tdBodys = ''; //数据
for (var i = 0, l = axisData.length; i < l; i++) {
for (var j = 0; j < series.length; j++) {
tdBodys += '<td>' + series[j].data[i] + '</td>'; //组装表数据
}
table += '<tr><td style="padding: 0 10px">' + axisData[i] + '</td>' + tdBodys + '</tr>';
tdBodys = '';
}
table += '</tbody></table></div>';
return table;
}
},