Spaces:
Running
Running
remova as funções desnecessarias
Browse files769 unmodified lines770771772773774775776777773779780781782783784785786787788789790791792793794774775776777678 unmodified lines145614571458147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577145914601579158014611462769 unmodified lines // Initialize multiselect components initMultiselect('xAxisSelect'); initMultiselect('yAxisSelect');
// PowerBI-like features document.getElementById('analyzeData').addEventListener('click', showDataInsights); // Generate chart button now shows "Update Chart" document.getElementById('generateChart').innerHTML = '<i class="fas fa-sync-alt mr-2"></i> Update Chart';// Reset chart button document.getElementById('resetChart').addEventListener('click', function() { if (currentChart) { currentChart.destroy(); currentChart = null; } document.querySelectorAll('.multiselect-selected').forEach(el => el.innerHTML = ''); }); // Export data button document.getElementById('exportData').addEventListener('click', exportData); document.getElementById('exportDataBtn').addEventListener('click', exportData); // Export chart button document.getElementById('exportChartBtn').addEventListener('click', exportChart); // File upload handler (now returns Promise)// File upload handler (now returns Promise) function handleFileUpload(e) { return new Promise((resolve, reject) => { const file = e.target.files[0];678 unmodified lines } }, 100); } // Export data function exportData() { if (rawData.length === 0) { alert('No data to export'); return; } const exportScope = document.querySelector('input[name="exportScope"]:checked').value; const exportFormat = document.getElementById('exportFormat').value; let dataToExport; if (exportScope === 'all') { dataToExport = [columns, ...rawData]; } else { dataToExport = [columns, ...filteredData]; } let blob, filename; if (exportFormat === 'csv') { const csvContent = dataToExport.map(row => row.map(cell => typeof cell === 'string' ? `"${cell.replace(/"/g, '""')}"` : cell ).join(',') ).join('\n'); blob = new Blob([csvContent], { type: 'text/csv;charset=utf-8;' }); filename = 'data_export.csv'; } else if (exportFormat === 'xlsx') { const ws = XLSX.utils.aoa_to_sheet(dataToExport); const wb = XLSX.utils.book_new(); XLSX.utils.book_append_sheet(wb, ws, 'Sheet1'); const excelBuffer = XLSX.write(wb, { bookType: 'xlsx', type: 'array' }); blob = new Blob([excelBuffer], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' }); filename = 'data_export.xlsx'; } else if (exportFormat === 'json') { const jsonData = []; const headers = dataToExport[0]; for (let i = 1; i < dataToExport.length; i++) { const obj = {}; for (let j = 0; j < headers.length; j++) { obj[headers[j]] = dataToExport[i][j]; } jsonData.push(obj); } blob = new Blob([JSON.stringify(jsonData, null, 2)], { type: 'application/json' }); filename = 'data_export.json'; } const url = URL.createObjectURL(blob); const a = document.createElement('a'); a.href = url; a.download = filename; document.body.appendChild(a); a.click(); document.body.removeChild(a); URL.revokeObjectURL(url); } // Export chart function exportChart() { if (!currentChart) { alert('No chart to export'); return; } const format = document.querySelector('input[name="chartFormat"]:checked').value; const quality = parseFloat(document.getElementById('chartQuality').value); const canvas = document.getElementById('dataChart'); let imageUrl; if (format === 'svg') { // SVG export (not supported directly by Chart.js, this is a simplified approach) const serializer = new XMLSerializer(); const svgBlob = new Blob([serializer.serializeToString(canvas)], { type: 'image/svg+xml' }); imageUrl = URL.createObjectURL(svgBlob); } else { // PNG or JPEG export imageUrl = canvas.toDataURL(`image/${format}`, quality); } const a = document.createElement('a'); a.href = imageUrl; a.download = `chart_export.${format}`; document.body.appendChild(a); a.click(); document.body.removeChild(a); if (format !== 'svg') { URL.revokeObjectURL(imageUrl); } } });}); </script> <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=jair2323/resmonit-1" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p><p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=jair2323/data-analyser" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body></body></html>index.html+3-122