';
h += '
📄 In the print dialog, choose Save as PDF as the destination / printer, then tap Save to download your analyzed report.
';
h += '
FormStat Analysis Report
';
h += '
Generated ' + new Date().toLocaleString() + ' • Responses: ' + DS.rows.length + ' • Questions: ' + DS.headers.length + (withCharts ? ' • With charts' : ' • Tables only') + '
';
DS.headers.forEach(function (qh, i) {
var vals = S.columnValues(DS.rows, i);
if (S.isNumericColumn(vals)) {
var d = S.descriptives(vals);
h += '
' + esc(qh) + ' (numeric)
n = ' + d.n + '
';
h += '
| Mean | SD | Median | Min | Max |
|---|
| ' + fmt(d.mean, 2) + ' | ' + fmt(d.sd, 2) + ' | ' + fmt(d.median, 2) + ' | ' + fmt(d.min, 2) + ' | ' + fmt(d.max, 2) + ' |
';
if (withCharts) h += '
' + histogramSVG(vals) + '
';
} else if (isMultiResp(vals)) {
var mr = S.multiResponse(vals);
h += '
' + esc(qh) + ' (multiple response)
';
h += '
Answered by ' + mr.nCases + ' respondents • ' + mr.nResponses + ' total selections
';
h += '
| Option | Selected by | % of responses | % of cases |
';
mr.options.forEach(function (o) {
h += '| ' + esc(o.value) + ' | ' + o.count + ' | ' + fmt(o.pctResponses) + ' | ' + fmt(o.pctCases) + ' |
';
});
h += '
';
if (withCharts) h += '
' + barSVG(mr.options.map(function (o) { return o.value; }), mr.options.map(function (o) { return o.count; })) + '
';
} else {
var f = S.frequency(vals);
h += '
' + esc(qh) + '
Valid: ' + f.valid + ' • Missing: ' + f.missing + '
';
h += '
| Value | Frequency | Percent | Valid Percent | Cumulative Percent |
';
f.table.forEach(function (r) {
h += '| ' + esc(r.value) + ' | ' + r.count + ' | ' + fmt(r.percent) + ' | ' + fmt(r.validPercent) + ' | ' + fmt(r.cumulativePercent) + ' |
';
});
h += '
';
if (withCharts) h += '
' + barSVG(f.table.map(function (r) { return r.value; }), f.table.map(function (r) { return r.count; })) + '
';
}
});
var keys = ['twoGroup', 'multiGroup', 'paired', 'corr', 'chisq', 'multiResp', 'oaAnova'];
if (keys.some(function (k) { return LAST[k]; })) {
h += '
Comparisons & tests
';
keys.forEach(function (k) {
if (LAST[k]) {
var comp = LAST[k];
if (!withCharts) comp = comp.replace(/
[\s\S]*?<\/svg><\/div>/g, '');
h += comp;
}
});
}
h += '
Analyzed with FormStat • By Abdul Hannan
';
h += '