Smart Productivity Trends Analyzer

Smart Productivity Trends Analyzer

Add New Data Point

Data Log

Date Tasks Comp. Focus (1-10) Hours Worked Interruptions Notes Actions

Note: Data is stored in your browser's LocalStorage. Clearing it here will remove all logged data permanently from this browser.

Analyze Productivity Trends

Data for Selected Range & Metric

DateMetric Value
`; pdfHTML += `

Analysis Parameters

`; pdfHTML += `

Metric Analyzed: ${metricLabel}

`; pdfHTML += `

Date Range: ${rangeStart} to ${rangeEnd}

`; pdfHTML += `

Moving Average Window: ${maWindow > 0 ? maWindow + ' points' : 'None'}

`; pdfHTML += `

Trend Chart for ${metricLabel}

`; pdfHTML += `
`; pdfHTML += `

${trendSummaryText}

`; pdfHTML += `

Data for Selected Range

`; const analysisTable = document.getElementById('spta-analysis-table-body').parentNode.outerHTML; pdfHTML += analysisTable; pdfHTML += `

Full Data Log (${sptaProductivityData.length} entries)

`; pdfHTML += ``; // Use the already date-sorted sptaProductivityData sptaProductivityData.forEach(d => { pdfHTML += ``; }); pdfHTML += `
DateTasks Comp.FocusHours WorkedInterruptionsNotes
${d.date.toLocaleDateString()}${d.tasksCompleted}${d.focusLevel} ${d.hoursWorked.toFixed(2)}${d.interruptions}${d.notes.substring(0,50)}${d.notes.length > 50 ? '...' : ''}
`; const pdfContainer = document.getElementById('spta-report-content-for-pdf'); pdfContainer.innerHTML = pdfHTML; const opt = { margin: [0.5, 0.4, 0.5, 0.4], filename: `Productivity_Trends_${metricLabel.replace(/\s/g,'_')}.pdf`, image: { type: 'jpeg', quality: 0.98 }, html2canvas: { scale: 2, useCORS: true, logging: false, scrollX:0, scrollY:0, windowWidth: pdfContainer.scrollWidth + 100 }, // Ensure content fits jsPDF: { unit: 'in', format: 'letter', orientation: 'portrait' }, pagebreak: { mode: ['avoid-all', 'css', 'legacy'] } }; html2pdf().from(pdfContainer).set(opt).save().then(() => { pdfContainer.innerHTML = ''; }).catch(err => { console.error("Error generating PDF:", err); pdfContainer.innerHTML = ''; alert("An error occurred while generating the PDF. Check console for details."); }); }
Scroll to Top