Historic Snowfall Data Viewer

Historic Snowfall Data Viewer

Compare average annual snowfall at major ski resorts worldwide.

Snowfall data will appear here. Please select resorts from the 'Data Configuration' tab.

Select Resorts to Compare

Please select at least one resort from the Data Configuration tab.

`; downloadBtn.classList.add('hidden'); return; } let tableHtml = data.resorts.map(resort => ` ${resort.name} ${resort.snowfall} cm ${(resort.snowfall / 2.54).toFixed(0)} in `).join(''); container.innerHTML = `

Average Annual Snowfall Comparison

${tableHtml}
Resort Centimeters Inches
`; downloadBtn.classList.remove('hidden'); const ctx = document.getElementById('snowfallChart')?.getContext('2d'); if(ctx) { if (snowfallChart) snowfallChart.destroy(); snowfallChart = new Chart(ctx, { type: 'bar', data: { labels: data.resorts.map(r => r.name), datasets: [{ label: 'Average Annual Snowfall (cm)', data: data.resorts.map(r => r.snowfall), backgroundColor: '#0ea5e9', borderColor: '#0284c7', borderWidth: 1, borderRadius: 4, }] }, options: { indexAxis: 'y', responsive: true, maintainAspectRatio: false, plugins: { legend: { display: false } }, scales: { x: { beginAtZero: true, title: { display: true, text: 'Snowfall (cm)' } } } } }); } } 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('snowfallChart'); if (chartCanvas && snowfallChart) { const img = new Image(); img.src = snowfallChart.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('Global-Snowfall-Report.pdf'); }); }
Scroll to Top