Local SIM Card vs. Global eSIM Cost Comparison Tool

Local SIM Card vs. Global eSIM Cost Comparison Tool

Enter your travel details to see a cost comparison.

Cheaper Option: ${results.cheaperOption}

Potential Savings: $${results.savings.toFixed(2)}

`; // Chart html += `
`; html += `
`; outputDiv.innerHTML = html; // Render Chart const ctx = document.getElementById('costChart').getContext('2d'); new Chart(ctx, { type: 'bar', data: { labels: ['Local SIM Card', 'Global eSIM'], datasets: [{ label: 'Total Estimated Cost', data: [results.localSimCost, results.eSimCost], backgroundColor: ['#FBBF24', '#F59E0B'], }] }, options: { responsive: true, plugins: { legend: { display: false }, title: { display: true, text: 'Total Cost by SIM Type' } }, scales: { y: { beginAtZero: true, ticks: { callback: function(value) { return '$' + value.toLocaleString(); } } } } } }); } // --- PDF Download --- function downloadPDF() { const { jsPDF } = window.jspdf; const loader = document.getElementById('loader'); loader.style.display = 'block'; const content = document.getElementById('pdf-content'); html2canvas(content, { scale: 2 }).then(canvas => { const imgData = canvas.toDataURL('image/png'); const pdf = new jsPDF({ orientation: 'p', unit: 'mm', format: 'a4' }); const pdfWidth = pdf.internal.pageSize.getWidth(); const imgWidth = pdfWidth - 20; const imgHeight = canvas.height * imgWidth / canvas.width; let heightLeft = imgHeight; let position = 10; pdf.addImage(imgData, 'PNG', 10, position, imgWidth, imgHeight); heightLeft -= (pdf.internal.pageSize.getHeight() - 20); while (heightLeft > 0) { position = heightLeft - imgHeight + 10; pdf.addPage(); pdf.addImage(imgData, 'PNG', 10, position, imgWidth, imgHeight); heightLeft -= (pdf.internal.pageSize.getHeight() - 20); } pdf.save('SIM_Cost_Comparison.pdf'); loader.style.display = 'none'; }); }
Scroll to Top