Cost of Living Comparison Guide

Cost of Living Comparison Guide

Compare the affordability of major cities around the world.

Your comparison will appear here. Please select regions from the 'Data Configuration' tab.

Select Regions to Compare

All scores are relative to New York City (Index = 100).

${tableHtml}
Destination Index Score
`; downloadBtn.classList.remove('hidden'); const ctx = document.getElementById('comparisonChart')?.getContext('2d'); if(ctx) { if (comparisonChart) comparisonChart.destroy(); comparisonChart = new Chart(ctx, { type: 'bar', data: { labels: data.destinations.map(d => d.name), datasets: [{ label: 'Cost of Living Index', data: data.destinations.map(d => d.index), backgroundColor: '#16a34a', borderColor: '#15803d', borderWidth: 1, borderRadius: 4, }] }, options: { indexAxis: 'y', responsive: true, maintainAspectRatio: false, plugins: { legend: { display: false } }, scales: { x: { beginAtZero: true, title: { display: true, text: 'Index Score (New York City = 100)' } } } } }); } } function downloadPDF() { const { jsPDF } = window.jspdf; const pdf = new jsPDF({ orientation: 'p', unit: 'mm', format: 'a4' }); const contentToPrint = document.getElementById('dashboard-content'); if (!contentToPrint) return; html2canvas(contentToPrint, { scale: 2, useCORS: true, onclone: (doc) => { const chartCanvas = doc.getElementById('comparisonChart'); if (chartCanvas && comparisonChart) { const img = new Image(); img.src = comparisonChart.toBase64Image(); img.style.maxWidth = '100%'; img.style.height = 'auto'; chartCanvas.parentNode.replaceChild(img, chartCanvas); } } }).then(canvas => { const imgData = canvas.toDataURL('image/png'); const pdfWidth = pdf.internal.pageSize.getWidth(); const pdfHeight = (canvas.height * pdfWidth) / canvas.width; pdf.addImage(imgData, 'PNG', 10, 10, pdfWidth - 20, pdfHeight > 277 ? 277 : pdfHeight - 20); pdf.save('Cost-of-Living-Comparison.pdf'); }); }
Scroll to Top