Real-Time Customer Interaction Analyzer Real-Time Customer Interaction Analyzer Simulating a live dashboard of customer service interactions and metrics. Live Dashboard Simulation Settings Live Metrics Download Report Active Interactions0 Avg. Handle Time0s Avg. CSAT0.0 Resolution Rate0% Agent Topic Sentiment Duration Simulation Speed (ms)How often the simulation updates. Lower is faster. New Interaction Chance (%)The chance a new interaction starts on each tick. Interaction End Chance (%)The chance an interaction ends on each tick. Customer Interaction Analysis Performance Snapshot Interaction Volume Trend Active Interactions Snapshot Avg. CSAT${csatEl.textContent} Resolution${resolutionEl.textContent}`; document.getElementById('pdf-chart-img').src = interactionsChart.toBase64Image(); const tableHTML = `AgentTopicSentimentDuration ${state.interactions.slice(0, 10).map(i => `${i.agent}${i.topic}${i.sentiment}${i.duration}s`).join('')}`; document.getElementById('pdf-table-container').innerHTML = tableHTML; const pdfContainer = document.getElementById('pdf-container'); pdfContainer.classList.remove('invisible', '-left-[9999px]'); try { const canvas = await html2canvas(document.getElementById('pdf-report'), { scale: 2 }); const imgData = canvas.toDataURL('image/jpeg', 0.9); const pdf = new jsPDF({ orientation: 'p', unit: 'px', format: 'a4' }); const pdfWidth = pdf.internal.pageSize.getWidth(); const pdfHeight = (canvas.height * pdfWidth) / canvas.width; pdf.addImage(imgData, 'JPEG', 0, 0, pdfWidth, pdfHeight); pdf.save('Interaction_Analysis_Report.pdf'); } catch (error) { console.error("PDF generation failed:", error); } finally { pdfContainer.classList.add('invisible', '-left-[9999px]'); } } initialize(); });