Add spreadsheet geenration based on jquery Grid

This commit is contained in:
2017-08-21 13:39:46 +02:00
parent 03615a3b66
commit 361b9af1fb
8 changed files with 4317 additions and 4 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -91,3 +91,30 @@ function buildChart(ctx, bare_data) {
}
});
}
function buildSpreadsheet(ctx, data) {
// Generate columns for header.
var columns = [{label: "", name: "", width: 300}];
for (label of data.labels) {
columns.push({label: label, name: label});
}
// Generate actual data.
var rows = [];
for (dataset of data.datasets) {
var row = [dataset.label];
for (value of dataset.data) {
row.push(secondsToHumanReadable(value));
}
rows.push(row);
}
// Create actual table.
$(ctx).jqGrid({
data: rows,
localReader: {repeatitems: true},
datatype: "local",
styleUI : 'Bootstrap',
colModel: columns,
caption: "Spreadsheet",
height: 300,
});
}