Macroeconomic Indicators Analysis Dashboard

Macroeconomic Indicators Analysis Dashboard

Edit Indicator Data

Modify the values below and click "Update Dashboard" to see your changes reflected in the charts. All data is customizable.

Year GDP Growth (%) Inflation (CPI, %) Unemployment (%) Interest Rate (%) Consumer Confidence

${latestData.inflation}%

Unemployment

${latestData.unemployment}%

Interest Rate

${latestData.interest}%

CCI

${latestData.cci}

`; }; const renderDashboard = () => { const labels = macroData.map(d => d.year); renderKpiCards(); createOrUpdateChart('gdpChart', 'GDP Growth Rate (%)', labels, macroData.map(d => d.gdp), '#4f46e5', 'Percentage (%)'); createOrUpdateChart('inflationChart', 'Inflation Rate (CPI, %)', labels, macroData.map(d => d.inflation), '#dc2626', 'Percentage (%)'); createOrUpdateChart('unemploymentChart', 'Unemployment Rate (%)', labels, macroData.map(d => d.unemployment), '#f59e0b', 'Percentage (%)'); createOrUpdateChart('interestRateChart', 'Federal Funds Interest Rate (%)', labels, macroData.map(d => d.interest), '#16a34a', 'Percentage (%)'); createOrUpdateChart('cciChart', 'Consumer Confidence Index (CCI)', labels, macroData.map(d => d.cci), '#2563eb', 'Index Value'); }; // --- PDF DOWNLOAD FUNCTIONALITY (II.C) --- const handlePdfDownload = async () => { const dashboardContent = document.getElementById('dashboard-content-to-export'); const dashboardControls = document.getElementById('dashboard-controls'); // Guard clauses if (!dashboardContent || !window.jspdf || !window.html2canvas) { console.error('Required PDF generation library or content not found.'); return; } const { jsPDF } = window.jspdf; // Temporarily hide controls to exclude them from the PDF (II.C.2) if (dashboardControls) dashboardControls.style.display = 'none'; try { const canvas = await html2canvas(dashboardContent, { scale: 2, // Improve resolution useCORS: true, logging: false }); const imgData = canvas.toDataURL('image/png'); const pdf = new jsPDF({ orientation: 'landscape', unit: 'px', format: [canvas.width, canvas.height] }); pdf.addImage(imgData, 'PNG', 0, 0, canvas.width, canvas.height); pdf.save('Macroeconomic_Dashboard_Analysis.pdf'); } catch (error) { console.error('Error generating PDF:', error); } finally { // Always restore visibility of the controls if (dashboardControls) dashboardControls.style.display = 'flex'; } }; if (pdfDownloadBtn) { pdfDownloadBtn.addEventListener('click', handlePdfDownload); } // --- INITIAL APPLICATION LOAD --- populateDataConfigTable(); renderDashboard(); }); // End of DOMContentLoaded
Scroll to Top